mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-14 02:30:02 -04:00
Exit the ./gen program on failed readdir() call
(cherry picked from commit 05b7c08a16)
This commit is contained in:
parent
477515fb09
commit
a17eb8dec4
1 changed files with 9 additions and 1 deletions
|
|
@ -28,8 +28,10 @@
|
|||
|
||||
#include <sys/types.h> /* Required on some systems for dirent.h. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h> /* XXXDCL Required for ?. */
|
||||
|
||||
#include <isc/lang.h>
|
||||
|
|
@ -66,9 +68,15 @@ next_file(isc_dir_t *dir) {
|
|||
dir->filename = NULL;
|
||||
|
||||
if (dir->handle != NULL) {
|
||||
errno = 0;
|
||||
dirent = readdir(dir->handle);
|
||||
if (dirent != NULL)
|
||||
if (dirent != NULL) {
|
||||
dir->filename = dirent->d_name;
|
||||
} else {
|
||||
if (errno != 0) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dir->filename != NULL)
|
||||
|
|
|
|||
Loading…
Reference in a new issue