index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Laszlo Papp <djszapi@archlinux.us> | 2009-10-11 15:52:12 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2009-10-11 15:52:12 -0500 |
commit | ab3c6f01f5c884233f718e7f7d5c32b2fdf4ff73 (patch) | |
tree | 3a6a60ed977c8db6d28f081721976b26845d5f27 | |
parent | 72bc947cbb8ba752f021f28ec9e9a85c354918e3 (diff) |
-rw-r--r-- | src/pacman/util.c | 36 | ||||
-rw-r--r-- | src/pacman/util.h | 1 |
diff --git a/src/pacman/util.c b/src/pacman/util.c index da2000ea..0e5e7f5c 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -99,42 +99,6 @@ int getcols(void) return 0; } -/* does the same thing as 'mkdir -p' */ -int makepath(const char *path) -{ - /* A bit of pointer hell here. Descriptions: - * orig - a copy of path so we can safely butcher it with strsep - * str - the current position in the path string (after the delimiter) - * ptr - the original position of str after calling strsep - * incr - incrementally generated path for use in access/mkdir call - */ - char *orig, *str, *ptr, *incr; - mode_t oldmask = umask(0000); - int ret = 0; - - orig = strdup(path); - incr = calloc(strlen(orig) + 1, sizeof(char)); - str = orig; - while((ptr = strsep(&str, "/"))) { - if(strlen(ptr)) { - /* we have another path component- append the newest component to - * existing string and create one more level of dir structure */ - strcat(incr, "/"); - strcat(incr, ptr); - if(access(incr, F_OK)) { - if(mkdir(incr, 0755)) { - ret = 1; - break; - } - } - } - } - free(orig); - free(incr); - umask(oldmask); - return(ret); -} - /* does the same thing as 'rm -rf' */ int rmrf(const char *path) { diff --git a/src/pacman/util.h b/src/pacman/util.h index a71de2d7..7a8c39d1 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -41,7 +41,6 @@ int trans_init(pmtransflag_t flags); int trans_release(void); int needs_root(void); int getcols(void); -int makepath(const char *path); int rmrf(const char *path); char *mbasename(const char *path); char *mdirname(const char *path); |