summaryrefslogtreecommitdiffstats
path: root/src/ideviceinstaller.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2014-05-27 11:34:18 +0200
committerGravatar Martin Szulecki2014-05-27 11:34:18 +0200
commit5fbd3251e9ab03be952a876f261ca466398c1696 (patch)
treedc682f87a474113e82dbb1e25c5f966f5d60ecc5 /src/ideviceinstaller.c
parentf6fc79344487ac8e1f335fb86e0fb71c316f94a2 (diff)
downloadideviceinstaller-5fbd3251e9ab03be952a876f261ca466398c1696.tar.gz
ideviceinstaller-5fbd3251e9ab03be952a876f261ca466398c1696.tar.bz2
Add support for installing from directories which contain symlinks
Diffstat (limited to 'src/ideviceinstaller.c')
-rw-r--r--src/ideviceinstaller.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c
index 17f7c17..55f3062 100644
--- a/src/ideviceinstaller.c
+++ b/src/ideviceinstaller.c
@@ -36,6 +36,9 @@
#include <limits.h>
#include <sys/stat.h>
#include <dirent.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/lockdown.h>
@@ -537,6 +540,14 @@ static void afc_upload_dir(afc_client_t afc, const char* path, const char* afcpa
strcat(apath, "/");
strcat(apath, ep->d_name);
+#ifdef HAVE_LSTAT
+ if ((lstat(fpath, &st) == 0) && S_ISLNK(st.st_mode)) {
+ char *target = (char *)malloc(st.st_size);
+ readlink(fpath, target, st.st_size);
+ afc_make_link(afc, AFC_SYMLINK, target, fpath);
+ free(target);
+ } else
+#endif
if ((stat(fpath, &st) == 0) && S_ISDIR(st.st_mode)) {
afc_upload_dir(afc, fpath, apath);
} else {