logo

utils-std

Collection of commonly available Unix tools
commit: de66de6c58a2e5978b17678716079c093d78ecfa
parent e060d81129e1b69ca72c2b873dab7881a38a9230
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed, 10 Apr 2024 08:09:05 +0200

cmd/mkdir: use strlen()-1 in the inline dirname

Diffstat:

Mcmd/mkdir.c2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/mkdir.c b/cmd/mkdir.c @@ -41,7 +41,7 @@ do_mkdir(char *path, mode_t mode) char parent[PATH_MAX] = ""; strncpy(parent, path, PATH_MAX); - for(int i = strlen(parent); i >= 0; i--) + for(int i = strlen(parent)-1; i >= 0; i--) { char c = parent[i]; parent[i] = 0;