summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/util.c6
-rw-r--r--src/pacman/util.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 2d0153e5..6834751f 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -381,7 +381,6 @@ int _alpm_rmrf(const char *path)
int errflag = 0;
struct dirent *dp;
DIR *dirp;
- char name[PATH_MAX];
struct stat st;
if(_alpm_lstat(path, &st) == 0) {
@@ -401,9 +400,10 @@ int _alpm_rmrf(const char *path)
return 1;
}
for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
- if(dp->d_ino) {
- 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];
+ sprintf(name, "%s/%s", path, dp->d_name);
errflag += _alpm_rmrf(name);
}
}
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);
}
}