summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2021-03-13 16:43:47 +0100
committerLeah Neukirchen <leah@vuxu.org>2021-03-13 16:43:47 +0100
commitc0d5710e119ba4429be83703a0716451d3cd2201 (patch)
treef5e33999a853bf3f1ffccfa5e47ffd8dcafa8f70
parent7a2647e9505338efd8a5712f15208ebd67450e76 (diff)
downloadnq-c0d5710e119ba4429be83703a0716451d3cd2201.tar.gz
nq-c0d5710e119ba4429be83703a0716451d3cd2201.tar.xz
nq-c0d5710e119ba4429be83703a0716451d3cd2201.zip
nq: simplify O_DIRECTORY usage
-rw-r--r--nq.c12
1 files 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 <time.h>
 #include <unistd.h>
 
+#ifndef O_DIRECTORY
+#define O_DIRECTORY 0
+#endif
+
 #ifdef NEED_DPRINTF
 #include <stdarg.h>
 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);