index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2011-06-09 13:34:13 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-09 14:14:55 -0500 |
commit | 9d6568da0f55fb05ea5c28e06efb51046fd270bf (patch) | |
tree | 6ca9f8c19159ca26c81b07c3fc55ee3ae65f7757 /lib | |
parent | 451cd2c88dcdec793ce7159331adcc2d049381e1 (diff) |
-rw-r--r-- | lib/libalpm/util.c | 15 |
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 6f0763d5..d24a51a6 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -631,17 +631,18 @@ const char *_alpm_filecache_setup(void) int _alpm_lstat(const char *path, struct stat *buf) { int ret; - char *newpath = strdup(path); - size_t len = strlen(newpath); + size_t len = strlen(path); /* strip the trailing slash if one exists */ - if(len != 0 && newpath[len - 1] == '/') { - newpath[len - 1] = '\0'; + if(len != 0 && path[len - 1] == '/') { + char *newpath = strdup(path); + newpath[len - 1] = '\0'; + ret = lstat(newpath, buf); + free(newpath); + } else { + ret = lstat(path, buf); } - ret = lstat(newpath, buf); - - FREE(newpath); return ret; } |