diff options
| -rw-r--r-- | src/ideviceinstaller.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c index 55f3062..3052577 100644 --- a/src/ideviceinstaller.c +++ b/src/ideviceinstaller.c | |||
| @@ -542,9 +542,13 @@ static void afc_upload_dir(afc_client_t afc, const char* path, const char* afcpa | |||
| 542 | 542 | ||
| 543 | #ifdef HAVE_LSTAT | 543 | #ifdef HAVE_LSTAT |
| 544 | if ((lstat(fpath, &st) == 0) && S_ISLNK(st.st_mode)) { | 544 | if ((lstat(fpath, &st) == 0) && S_ISLNK(st.st_mode)) { |
| 545 | char *target = (char *)malloc(st.st_size); | 545 | char *target = (char *)malloc(st.st_size+1); |
| 546 | readlink(fpath, target, st.st_size); | 546 | if (readlink(fpath, target, st.st_size+1) < 0) { |
| 547 | afc_make_link(afc, AFC_SYMLINK, target, fpath); | 547 | fprintf(stderr, "ERROR: readlink: %s (%d)\n", strerror(errno), errno); |
| 548 | } else { | ||
| 549 | target[st.st_size] = '\0'; | ||
| 550 | afc_make_link(afc, AFC_SYMLINK, target, fpath); | ||
| 551 | } | ||
| 548 | free(target); | 552 | free(target); |
| 549 | } else | 553 | } else |
| 550 | #endif | 554 | #endif |
