From c0d5710e119ba4429be83703a0716451d3cd2201 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Sat, 13 Mar 2021 16:43:47 +0100 Subject: nq: simplify O_DIRECTORY usage --- nq.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/nq.c b/nq.c index 6d3d919..9ef1955 100644 --- a/nq.c +++ b/nq.c @@ -44,6 +44,10 @@ #include #include +#ifndef O_DIRECTORY +#define O_DIRECTORY 0 +#endif + #ifdef NEED_DPRINTF #include static int @@ -157,11 +161,7 @@ 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); @@ -176,11 +176,7 @@ usage: } } -#ifdef O_DIRECTORY donedirfd = open(donepath, O_RDONLY | O_DIRECTORY); -#else - donedirfd = open(donepath, O_RDONLY); -#endif if (donedirfd < 0) { perror("dir open"); exit(111); -- cgit 1.4.1