summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2011-10-06 03:42:21 +0200
committerGravatar Martin Szulecki2012-03-19 01:45:20 +0100
commit89dd2654339ad3f0123798e453513e8c62d0fd77 (patch)
tree0685775b886be630f012c3d09af8eac75b3af18d /tools
parent62f16c72e4416acf369640a0dff4960bc3e2c0a5 (diff)
downloadlibimobiledevice-89dd2654339ad3f0123798e453513e8c62d0fd77.tar.gz
libimobiledevice-89dd2654339ad3f0123798e453513e8c62d0fd77.tar.bz2
idevicebackup2: don't list . and .. in directories.
Diffstat (limited to 'tools')
-rw-r--r--tools/idevicebackup2.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index 30e3724..2c77e1f 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -1004,6 +1004,9 @@ static void mb2_handle_list_directory(plist_t message, const char *backup_dir)
if (cur_dir) {
struct dirent* ep;
while ((ep = readdir(cur_dir))) {
+ if ((strcmp(ep->d_name, ".") == 0) || (strcmp(ep->d_name, "..") == 0)) {
+ continue;
+ }
char *fpath = build_path(path, ep->d_name, NULL);
if (fpath) {
plist_t fdict = plist_new_dict();
@@ -1122,6 +1125,9 @@ static void mb2_copy_directory_by_path(const char *src, const char *dst)
if (cur_dir) {
struct dirent* ep;
while ((ep = readdir(cur_dir))) {
+ if ((strcmp(ep->d_name, ".") == 0) || (strcmp(ep->d_name, "..") == 0)) {
+ continue;
+ }
char *srcpath = build_path(src, ep->d_name, NULL);
char *dstpath = build_path(dst, ep->d_name, NULL);
if (srcpath && dstpath) {