[hackers] [sbase] Fix mkdir -p with a leading / || sin

From: <git_AT_suckless.org>
Date: Mon, 20 Apr 2015 18:47:37 +0200 (CEST)

commit 6e30efb9bb3b42bb27270f8ab2e2fc545fccb3c5
Author: sin <sin_AT_2f30.org>
Date: Mon Apr 20 17:39:50 2015 +0100

    Fix mkdir -p with a leading /

diff --git a/config.mk b/config.mk
index 45cf37e..84525ce 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -13,4 +13,4 @@ RANLIB = ranlib
 # For NetBSD add -D_NETBSD_SOURCE
 CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
 CFLAGS = -std=c99 -Wall -pedantic
-LDFLAGS = -s -lrt
+LDFLAGS = -s
diff --git a/mkdir.c b/mkdir.c
index 1b0bf91..9d4951a 100644
--- a/mkdir.c
+++ b/mkdir.c
_AT_@ -11,7 +11,7 @@ mkdirp(char *path)
 {
         char *p;
 
- for (p = path; *p; p++) {
+ for (p = path + (*path == '/'); *p; p++) {
                 if (*p != '/')
                         continue;
                 *p = '\0';
Received on Mon Apr 20 2015 - 18:47:37 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 20 2015 - 18:48:14 CEST