diff options
author | Rob Landley <rob@landley.net> | 2014-03-11 20:44:55 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-03-11 20:44:55 -0500 |
commit | ca1b60e3bdb19eca981e5ccf4e07100aafddb007 (patch) | |
tree | 96c6370fc73f015c20031194551d9238dd176191 /lib/xwrap.c | |
parent | a8b88fe47237028fb5314c4c572a738b967b10b7 (diff) | |
download | toybox-ca1b60e3bdb19eca981e5ccf4e07100aafddb007.tar.gz |
Move mkpathat to lib, remove redundant function used by patch.
Diffstat (limited to 'lib/xwrap.c')
-rw-r--r-- | lib/xwrap.c | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c index 2ecffaad..51bd2b43 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -369,34 +369,6 @@ void xchroot(char *path) xchdir("/"); } -// Ensure entire path exists. -// If mode != -1 set permissions on newly created dirs. -// Requires that path string be writable (for temporary null terminators). -void xmkpath(char *path, int mode) -{ - char *p, old; - mode_t mask; - int rc; - struct stat st; - - for (p = path; ; p++) { - if (!*p || *p == '/') { - old = *p; - *p = rc = 0; - if (stat(path, &st) || !S_ISDIR(st.st_mode)) { - if (mode != -1) { - mask=umask(0); - rc = mkdir(path, mode); - umask(mask); - } else rc = mkdir(path, 0777); - } - *p = old; - if(rc) perror_exit("mkpath '%s'", path); - } - if (!*p) break; - } -} - struct passwd *xgetpwuid(uid_t uid) { struct passwd *pwd = getpwuid(uid); |