about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-08-28 14:09:30 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2015-08-28 14:09:30 +0200
commit2012f8697caabceb3e45260367fe3524dba7015f (patch)
tree8a0c5e1b1e75d9e1d3578abfb5412c67648aeebd
parent7a28310a3ed18524c0ec7ee97f7f48e95b1d92a9 (diff)
downloadnq-2012f8697caabceb3e45260367fe3524dba7015f.tar.gz
nq-2012f8697caabceb3e45260367fe3524dba7015f.tar.xz
nq-2012f8697caabceb3e45260367fe3524dba7015f.zip
nq: open dirfd with O_DIRECTORY to fail early
-rw-r--r--nq.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/nq.c b/nq.c
index a324bd3..04223bd 100644
--- a/nq.c
+++ b/nq.c
@@ -121,7 +121,7 @@ usage:
 		}
 	}
 
-	dirfd = open(path, O_RDONLY);
+	dirfd = open(path, O_RDONLY | O_DIRECTORY);
 	if (dirfd < 0) {
 		perror("dir open");
 		exit(111);