realtek: Add support for Layer 2 Multicast
[openwrt/openwrt.git] / tools / mtd-utils / patches / 320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch
1 --- a/jffsX-utils/mkfs.jffs2.c
2 +++ b/jffsX-utils/mkfs.jffs2.c
3 @@ -109,7 +109,7 @@ static char *rootdir = default_rootdir;
4 static int verbose = 0;
5 static int squash_uids = 0;
6 static int squash_perms = 0;
7 -static int fake_times = 0;
8 +static time_t fixed_timestamp = -1;
9 int target_endian = __BYTE_ORDER;
10
11 static uint32_t find_hardlink(struct filesystem_entry *e)
12 @@ -251,8 +251,8 @@ static struct filesystem_entry *add_host
13 mode &= ~(S_ISUID | S_ISGID);
14 }
15 }
16 - if (fake_times) {
17 - timestamp = 0;
18 + if (fixed_timestamp != -1) {
19 + timestamp = fixed_timestamp;
20 }
21
22 entry = xcalloc(1, sizeof(struct filesystem_entry));
23 @@ -1558,6 +1558,20 @@ static void parse_image(void){
24 close(in_fd);
25 }
26
27 +static void set_source_date_epoch() {
28 + char *env = getenv("SOURCE_DATE_EPOCH");
29 + char *endptr = env;
30 + errno = 0;
31 + if (env && *env) {
32 + fixed_timestamp = strtoull(env, &endptr, 10);
33 + if (errno || (endptr && *endptr != '\0')) {
34 + fprintf(stderr, "Invalid SOURCE_DATE_EPOCH");
35 + exit(1);
36 + }
37 + }
38 +}
39 +
40 +
41 int main(int argc, char **argv)
42 {
43 int c, opt;
44 @@ -1576,6 +1590,7 @@ int main(int argc, char **argv)
45 warn_page_size = 1; /* warn user if page size not 4096 */
46
47 jffs2_compressors_init();
48 + set_source_date_epoch();
49
50 while ((opt = getopt_long(argc, argv,
51 "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0)
52 @@ -1626,7 +1641,7 @@ int main(int argc, char **argv)
53 break;
54
55 case 'f':
56 - fake_times = 1;
57 + fixed_timestamp = 0;
58 break;
59
60 case 'h':