summaryrefslogtreecommitdiff
path: root/src/archive.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-07-23 13:19:48 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-07-23 13:19:48 +0000
commit8806ce875e4e1d3dabbfd6a6cf12a3b5a6257ed9 (patch)
tree90d26246ad6016b74b2b4d9f8828f31c6178ba53 /src/archive.c
parent042879f417fa1d0a0ab174b4c8f3847ee1f148b5 (diff)
downloadapk-tools-8806ce875e4e1d3dabbfd6a6cf12a3b5a6257ed9.tar.gz
apk-tools-8806ce875e4e1d3dabbfd6a6cf12a3b5a6257ed9.tar.bz2
apk-tools-8806ce875e4e1d3dabbfd6a6cf12a3b5a6257ed9.tar.xz
apk-tools-8806ce875e4e1d3dabbfd6a6cf12a3b5a6257ed9.zip
archive: append .apk-new to hard link targets
Otherwise will link(2) fail since it does not exist.
Diffstat (limited to 'src/archive.c')
-rw-r--r--src/archive.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/archive.c b/src/archive.c
index 3a430b2..4005bf1 100644
--- a/src/archive.c
+++ b/src/archive.c
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <sysexits.h>
#include <sys/wait.h>
+#include <limits.h>
#include "apk_defines.h"
#include "apk_archive.h"
@@ -334,7 +335,10 @@ int apk_archive_entry_extract(const struct apk_file_info *ae,
r = 0;
close(fd);
} else {
- r = link(ae->link_target, fn);
+ char link_target[PATH_MAX];
+ snprintf(link_target, sizeof(link_target),
+ "%s.apk-new", ae->link_target);
+ r = link(link_target, fn);
}
break;
case S_IFLNK: