mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-09 12:55:23 +01:00
There is no way for gzip 1.2.4 and tar 1.12 to disable the inclusion of timestamps into the tarball/gzip, which creates non-reproducible tarballs and hence packages. While it is theoretically possible to set the timestamps to unix time 0 using touch, in reality this is not possible because mes libc does not support utime() which sets the timestamp of a file from userspace. So we need to ignore it rather than (re)set it.
30 lines
569 B
C
30 lines
569 B
C
/*
|
|
* SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#include <sys/stat.h>
|
|
#include <linux/syscall.h>
|
|
#include <linux/x86/syscall.h>
|
|
|
|
int _stat(const char *path, struct stat *buf) {
|
|
int rc = stat(path, buf);
|
|
if (rc == 0) {
|
|
buf->st_atime = 0;
|
|
buf->st_mtime = 0;
|
|
}
|
|
return rc;
|
|
}
|
|
|
|
int _lstat(const char *path, struct stat *buf) {
|
|
int rc = lstat(path, buf);
|
|
if (rc == 0) {
|
|
buf->st_atime = 0;
|
|
buf->st_mtime = 0;
|
|
}
|
|
return rc;
|
|
}
|
|
|
|
#define stat(a,b) _stat(a,b)
|
|
#define lstat(a,b) _lstat(a,b)
|