From 3202ec2014a6ca73e09dda3d16a2017e56174fd4 Mon Sep 17 00:00:00 2001 From: Hoorad Farrokh Date: Mon, 22 Apr 2024 18:34:03 +1200 Subject: [PATCH] Fixed error messege if p flag --- src/mkdir/mkdir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mkdir/mkdir.c b/src/mkdir/mkdir.c index 5017503..4e40390 100644 --- a/src/mkdir/mkdir.c +++ b/src/mkdir/mkdir.c @@ -35,7 +35,7 @@ int str_to_mode(const char *str, mode_t *mode) { static void make_dir(const char *path) { if (mkdir(path, mode) == -1) { - if (!pflag) { + if (!pflag || (errno != ENOENT && pflag)) { fprintf(stderr, "mkdir: cannot create directory '%s': %s \n", path, strerror(errno)); }