summaryrefslogtreecommitdiffstats
path: root/src/extract.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/extract.c')
-rw-r--r--src/extract.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/extract.c b/src/extract.c
index 616b8d1..5ba7869 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -12,22 +12,19 @@
#include "util.h"
static int cb(struct package *p, const char *name, const char *path, void *u) {
- struct stat st;
- uint32_t size;
-
- if (stat(path, &st) < 0) {
+ int r;
+
+ if ((r = access(path, R_OK)) < 0) {
if (errno == ENOENT)
- size = 0;
- else {
- fprintf(stderr, "stat(%s) failed: %s\n", path, strerror(errno));
- return -1;
- }
- } else
- size = (uint32_t) st.st_size;
+ return 0;
+
+ fprintf(stderr, "stat(%s) failed: %s\n", path, strerror(errno));
+ return -1;
+ }
- if (size) {
+ if (r == 0) {
fprintf(stderr, "Extracting %s ...\n", name);
- return copy_file(path, name);
+ return copy_or_link_file(path, name, 1);
}
return 0;