diff options
-rw-r--r-- | fq.c | 8 | ||||
-rw-r--r-- | nq.c | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/fq.c b/fq.c index 7364ba7..b92aa56 100644 --- a/fq.c +++ b/fq.c @@ -83,7 +83,11 @@ main(int argc, char *argv[]) if (!path) path = "."; +#ifdef O_DIRECTORY dirfd = open(path, O_RDONLY | O_DIRECTORY); +#else + dirfd = open(path, O_RDONLY); +#endif if (dirfd < 0) { perror("open dir"); exit(111); @@ -99,8 +103,10 @@ main(int argc, char *argv[]) optind = 0; dir = fdopendir(dirfd); - if (!dir) + if (!dir) { + perror("fdopendir"); exit(111); + } while ((d = readdir(dir))) { if (d->d_name[0] != ',') diff --git a/nq.c b/nq.c index 04223bd..67e3485 100644 --- a/nq.c +++ b/nq.c @@ -121,7 +121,11 @@ usage: } } +#ifdef O_DIRECTORY dirfd = open(path, O_RDONLY | O_DIRECTORY); +#else + dirfd = open(path, O_RDONLY); +#endif if (dirfd < 0) { perror("dir open"); exit(111); |