commit 494ad19401db718a4806e5cf65f6bb6916927bc0
parent 05438fee31a525193b6f776bfb2962e7c0275596
Author: sin <sin@2f30.org>
Date: Mon, 20 May 2019 13:57:55 +0300
Fix dup-init so the repo can be created in the current directory
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dup-init.c b/dup-init.c
@@ -2,6 +2,7 @@
#include <sys/stat.h>
#include <err.h>
+#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdint.h>
@@ -126,7 +127,7 @@ main(int argc, char *argv[])
repo, STORAGEPATH) >= sizeof(bpath))
errx(1, "snprintf: %s: path too long", bpath);
- if (mkdir(repo, 0700) < 0)
+ if (mkdir(repo, 0700) < 0 && errno != EEXIST)
err(1, "mkdir: %s", repo);
if ((lfd = lockrepo(repo)) < 0)