summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Brunel <i.am.jack.mail@gmail.com>2012-01-09 21:37:31 +0100
committerDan McGee <dan@archlinux.org>2012-01-19 05:08:03 +0100
commit1b50223f8240456b8c989b5c1e016f4a245b527c (patch)
treeef49927c1925788e59a599ecdc072c9c231ed8fd /src
parentc77cec2ffc850fa28c5720b8902acc5421069ae4 (diff)
downloadpacman-1b50223f8240456b8c989b5c1e016f4a245b527c.tar.gz
pacman-1b50223f8240456b8c989b5c1e016f4a245b527c.tar.xz
util.c, rmrf(): only create string when needed
The entry's name is only used when not "." or ".." so only print the string then. Signed-off-by: Olivier Brunel <i.am.jack.mail@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 76054132..a8f19682 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -192,10 +192,10 @@ int rmrf(const char *path)
return 1;
}
for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
- if(dp->d_ino) {
- char name[PATH_MAX];
- sprintf(name, "%s/%s", path, dp->d_name);
+ if(dp->d_name) {
if(strcmp(dp->d_name, "..") != 0 && strcmp(dp->d_name, ".") != 0) {
+ char name[PATH_MAX];
+ snprintf(name, PATH_MAX, "%s/%s", path, dp->d_name);
errflag += rmrf(name);
}
}