commit 62e3b353d4deb68012b257e9debc351ddf454769
parent 81c2c0671a98a4ff22a1d95fd302e6a3c35898a8
Author: sin <sin@2f30.org>
Date: Fri, 3 May 2019 16:33:20 +0100
Check mkdir() return value
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dup-init.c b/dup-init.c
@@ -78,11 +78,13 @@ main(int argc, char *argv[])
bpar.key = NULL;
}
- mkdir(repo, 0700);
+ if (mkdir(repo, 0700) < 0)
+ err(1, "mkdir: %s", repo);
if (chdir(repo) < 0)
err(1, "chdir: %s", repo);
- mkdir(ARCHIVEPATH, 0700);
+ if (mkdir(ARCHIVEPATH, 0700) < 0)
+ err(1, "mkdir: %s", ARCHIVEPATH);
if (bcreat(STORAGEPATH, 0600, &bpar, &bctx) < 0)
berr("bcreat: %s", STORAGEPATH);
if (bclose(bctx) < 0)