about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-08-28 14:08:35 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2015-08-28 14:08:35 +0200
commit7a28310a3ed18524c0ec7ee97f7f48e95b1d92a9 (patch)
treeb8c46ce45ecff2f255f465d045536a48a4ce4b64
parent0eae839cb19f9384e742fb94e102042d25b89780 (diff)
downloadnq-7a28310a3ed18524c0ec7ee97f7f48e95b1d92a9.tar.gz
nq-7a28310a3ed18524c0ec7ee97f7f48e95b1d92a9.tar.xz
nq-7a28310a3ed18524c0ec7ee97f7f48e95b1d92a9.zip
nq: mkdir $NQDIR
-rw-r--r--nq.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/nq.c b/nq.c
index c5c7223..a324bd3 100644
--- a/nq.c
+++ b/nq.c
@@ -114,6 +114,13 @@ usage:
 	if (!path)
 		path = ".";
 
+	if (mkdir(path, 0777) < 0) {
+		if (errno != EEXIST) {
+			perror("mkdir");
+			exit(111);
+		}
+	}
+
 	dirfd = open(path, O_RDONLY);
 	if (dirfd < 0) {
 		perror("dir open");