Skip to content

Commit b471d2c

Browse files
authored
Preserve timestamps when extracting the squashfs (#1)
probonopd/static-tools#42 Thanks @lalten
1 parent 5d62873 commit b471d2c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/runtime/runtime.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,11 @@ bool extract_appimage(const char* const appimage_path, const char* const _prefix
764764
fwrite(buf, 1, bytes_at_a_time, f);
765765
bytes_already_read = bytes_already_read + bytes_at_a_time;
766766
}
767+
fflush(f);
768+
int fd = fileno(f);
769+
struct timespec times[] = { st.st_atim, st.st_mtim };
770+
if (futimens(fd, times) != 0)
771+
fprintf(stderr, "futimens: %s\n", strerror(errno));
767772
fclose(f);
768773
chmod(prefixed_path_to_extract, st.st_mode);
769774
if (!rv)

0 commit comments

Comments
 (0)