Skip to content

Commit a39b12c

Browse files
committed
Also compare file sizes to make existence check more robust
1 parent 8a9f67e commit a39b12c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/runtime.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,11 @@ bool extract_appimage(const char* const appimage_path, const char* const _prefix
350350
continue;
351351
}
352352
} else {
353-
if (!overwrite && access(prefixed_path_to_extract, F_OK) == 0)
353+
struct stat st;
354+
if (!overwrite && stat(prefixed_path_to_extract, &st) == 0 && st.st_size == inode.xtra.reg.file_size) {
355+
fprintf(stderr, "File exists and file size matches, skipping\n");
354356
continue;
357+
}
355358

356359
// track the path we extract to for this inode, so that we can `link` if this inode is found again
357360
created_inode[inode.base.inode_number - 1] = strdup(prefixed_path_to_extract);

0 commit comments

Comments
 (0)