about summary refs log tree commit diff
diff options
context:
space:
mode:
-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");