diff options
Diffstat (limited to 'patches/prelink-0.0.20071009/generic/init.dpatch')
-rw-r--r-- | patches/prelink-0.0.20071009/generic/init.dpatch | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/patches/prelink-0.0.20071009/generic/init.dpatch b/patches/prelink-0.0.20071009/generic/init.dpatch new file mode 100644 index 000000000..7a1269ea3 --- /dev/null +++ b/patches/prelink-0.0.20071009/generic/init.dpatch @@ -0,0 +1,86 @@ +#! /bin/sh -e +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Adds method to re-execute /sbin/init upon change made by prelink. +## DP: Bug#281409 + +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts +patch_opts="${patch_opts:--f --no-backup-if-mismatch}" + +if [ $# -ne 1 ]; then + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1 +fi +case "$1" in + -patch) patch $patch_opts -p1 < $0;; + -unpatch) patch $patch_opts -p1 -R < $0;; + *) + echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" + exit 1;; +esac + +exit 0 +@DPATCH@ + +diff -urN prelink-0.0.20041012.orig/src/main.c prelink-0.0.20041012/src/main.c +--- prelink-0.0.20041012.orig/src/main.c 2004-09-30 16:07:57.000000000 +0000 ++++ prelink-0.0.20041012/src/main.c 2004-11-16 00:39:28.000000000 +0000 +@@ -58,6 +58,8 @@ + const char *prelink_conf = PRELINK_CONF; + const char *prelink_cache = PRELINK_CACHE; + const char *undo_output; ++int noreexecinit; ++time_t initctime; + + const char *argp_program_version = "prelink 1.0"; + +@@ -111,6 +113,7 @@ + {"mmap-region-end", OPT_MMAP_REG_END, "BASE_ADDRESS", OPTION_HIDDEN, "" }, + {"seed", OPT_SEED, "SEED", OPTION_HIDDEN, "" }, + {"compute-checksum", OPT_COMPUTE_CHECKSUM, 0, OPTION_HIDDEN, "" }, ++ {"init", 'i', 0, 0, "Do not re-execute init" }, + { 0 } + }; + +@@ -222,12 +225,29 @@ + case OPT_COMPUTE_CHECKSUM: + compute_checksum = 1; + break; ++ case 'i': ++ noreexecinit=1; ++ break; + default: + return ARGP_ERR_UNKNOWN; + } + return 0; + } + ++time_t get_ctime(const char *file) { ++ struct stat st; ++ if(stat(file,&st) == 0) ++ return st.st_ctime; ++ return 0; ++} ++ ++void checkinit() { ++ if(initctime != get_ctime("/sbin/init")) { ++ printf("Executing /sbin/init U\n"); ++ system("/sbin/init U"); ++ } ++} ++ + static struct argp argp = { options, parse_opt, "[FILES]", argp_doc }; + + int +@@ -247,6 +267,11 @@ + + argp_parse (&argp, argc, argv, 0, &remaining, 0); + ++ if(!noreexecinit) { ++ initctime = get_ctime("/sbin/init"); ++ atexit(checkinit); ++ } ++ + if (ld_library_path == NULL) + ld_library_path = getenv ("LD_LIBRARY_PATH"); + |