From 89dd2654339ad3f0123798e453513e8c62d0fd77 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 6 Oct 2011 03:42:21 +0200 Subject: idevicebackup2: don't list . and .. in directories. --- tools/idevicebackup2.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tools/idevicebackup2.c') 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) { -- cgit v1.1-32-gdbae