Magellan Linux

Contents of /trunk/prelink/patches/prelink-20040707-init.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 153 - (show annotations) (download)
Tue May 8 20:52:56 2007 UTC (17 years ago) by niro
File size: 1471 byte(s)
-import

1 --- prelink-20040707/src/main.c.jj 2004-09-09 09:53:05.281838640 -0700
2 +++ prelink-20040707/src/main.c 2004-09-09 10:31:09.029656200 -0700
3 @@ -58,6 +58,8 @@
4 const char *prelink_conf = PRELINK_CONF;
5 const char *prelink_cache = PRELINK_CACHE;
6 const char *undo_output;
7 +int noreexecinit;
8 +time_t initctime;
9
10 const char *argp_program_version = "prelink 1.0";
11
12 @@ -111,6 +113,7 @@
13 {"mmap-region-end", OPT_MMAP_REG_END, "BASE_ADDRESS", OPTION_HIDDEN, "" },
14 {"seed", OPT_SEED, "SEED", OPTION_HIDDEN, "" },
15 {"compute-checksum", OPT_COMPUTE_CHECKSUM, 0, OPTION_HIDDEN, "" },
16 + {"init", 'i', 0, 0, "Do not re-execute init" },
17 { 0 }
18 };
19
20 @@ -222,12 +225,29 @@
21 case OPT_COMPUTE_CHECKSUM:
22 compute_checksum = 1;
23 break;
24 + case 'i':
25 + noreexecinit=1;
26 + break;
27 default:
28 return ARGP_ERR_UNKNOWN;
29 }
30 return 0;
31 }
32
33 +time_t get_ctime(const char *file) {
34 + struct stat st;
35 + if(stat(file,&st) == 0)
36 + return st.st_ctime;
37 + return 0;
38 +}
39 +
40 +void checkinit() {
41 + if(initctime != get_ctime("/sbin/init")) {
42 + printf("Executing /sbin/init U\n");
43 + system("/sbin/init U");
44 + }
45 +}
46 +
47 static struct argp argp = { options, parse_opt, "[FILES]", argp_doc };
48
49 int
50 @@ -247,6 +267,11 @@
51
52 argp_parse (&argp, argc, argv, 0, &remaining, 0);
53
54 + if(!noreexecinit) {
55 + initctime = get_ctime("/sbin/init");
56 + atexit(checkinit);
57 + }
58 +
59 if (ld_library_path == NULL)
60 ld_library_path = getenv ("LD_LIBRARY_PATH");
61