glibc-helpers-2.5.1-alt4.M41.2/000075500000000000000000000000001167036546600156155ustar00rootroot00000000000000glibc-helpers-2.5.1-alt4.M41.2/Makefile000064400000000000000000000012501167036546600172530ustar00rootroot00000000000000INSTALL = install CFLAGS = $(RPM_OPT_FLAGS) SRC = glibc_post_upgrade.c post_ldconfig.c postun_ldconfig.c glibc_preinstall.c C_TARGETS = $(SRC:.c=) I_TARGETS = glibc_fix_ldconfig glibc_fix_nsswitch glibc_post_upgrade post_ldconfig postun_ldconfig glibc_preinstall enablekernel = .PHONY: all install clean all: $(C_TARGETS) install: $(I_TARGETS) for f in $^; do \ $(INSTALL) -pD -m700 $$f $(RPM_BUILD_ROOT)/sbin/$$f; \ done clean: $(RM) $(C_TARGETS) *~ glibc_preinstall: glibc_preinstall.c gcc '-DMIN_KERNEL_VERSION="$(enablekernel)"' -Wall -W -Os -static \ -nostartfiles -fno-stack-protector -U_FORTIFY_SOURCE \ -L$(path_link) glibc_preinstall.c -o glibc_preinstall glibc-helpers-2.5.1-alt4.M41.2/glibc_fix_ldconfig000064400000000000000000000002331167036546600213310ustar00rootroot00000000000000#!/bin/sh -efu if ! grep -qs /etc/ld.so.conf.d/ /etc/ld.so.conf; then umask 022 printf '\n%s\n' 'include /etc/ld.so.conf.d/*.conf' >>/etc/ld.so.conf fi glibc-helpers-2.5.1-alt4.M41.2/glibc_fix_nsswitch000064400000000000000000000002721167036546600214110ustar00rootroot00000000000000#!/bin/sh f=/etc/nsswitch.conf if [ ! -f "$f" ]; then if [ -f "$f".rpmsave ]; then /bin/cp -pf "$f".rpmsave "$f" elif [ -f "$f".rpmnew ]; then /bin/cp -pf "$f".rpmnew "$f" fi fi glibc-helpers-2.5.1-alt4.M41.2/glibc_post_upgrade.c000064400000000000000000000024341167036546600216200ustar00rootroot00000000000000#include #include #include #include #include #include #include static int exec_wait (const char *path, const char *av[]) { pid_t pid = vfork (); if (pid < 0) return 1; if (!pid) { execv (path, (char *const *) av); _exit (1); } else { int status = 0; if (waitpid (pid, &status, 0) != pid || !WIFEXITED (status)) return 1; return WEXITSTATUS (status); } } int main (int ac, const char *av[]) { int rc; const char *ldconfig_args[] = { "ldconfig", 0 }; const char *telinit_args[] = { "telinit", "u", 0 }; const char *telinit_path = "/sbin/telinit"; const char *p; char initpath[4096]; if ((p = getenv ("RPM_INSTALL_ARG1")) && (*p != '0') && (*p != '1')) (void) exec_wait ("/sbin/glibc_fix_ldconfig", ldconfig_args); if ((rc = exec_wait ("/sbin/post_ldconfig", ldconfig_args))) return rc; /* Check if telinit is available and the init fifo as well. */ if (access (telinit_path, X_OK) || access ("/dev/initctl", F_OK)) return 0; /* Check if we are not inside of some chroot. */ if (readlink ("/proc/1/exe", initpath, sizeof initpath) <= 0 || readlink ("/proc/1/root", initpath, sizeof initpath) <= 0) return 0; return exec_wait (telinit_path, telinit_args); } glibc-helpers-2.5.1-alt4.M41.2/glibc_preinstall.c000064400000000000000000000025371167036546600213050ustar00rootroot00000000000000/* gcc -static -Os -W -nostartfiles -fno-stack-protector -U_FORTIFY_SOURCE glibc_preinstall.c */ #include #include #include #ifndef MIN_KERNEL_VERSION # error "MIN_KERNEL_VERSION not defined" #endif #define PRINT_MSG(msg) write(2, (msg), sizeof(msg) - 1) #define FATAL(msg) do {PRINT_MSG(msg); kill_parent(); _exit(1);} while(0) static void kill_parent(void) { pid_t pid = getppid(); if (pid < 100) return; PRINT_MSG("Sending SIGSTOP signal to parent process.\n"); (void) kill(pid, SIGSTOP); } static int is_digit(char c) { return c >= '0' && c <= '9'; } static int parse_release(const char *p) { unsigned int i, osversion = 0; for (i = 0; i < 3 && *p; i++, ++p) { unsigned int d = 0; for (; is_digit(*p); ++p) d = d * 10 + (*p - '0'); if (d == 0 || d >= 255 || (i < 2 && *p && *p != '.')) { osversion = 0; break; } osversion |= d << (16 - 8 * i); } return osversion; } static void check_kernel_version(void) { struct utsname name; if (uname(&name) < 0) FATAL("kernel version check failed: uname syscall failed.\n"); if (parse_release(name.release) < parse_release(MIN_KERNEL_VERSION)) FATAL("kernel version check failed: KERNEL TOO OLD, " "minimal version supported by glibc is " MIN_KERNEL_VERSION ".\n"); } void _start(void) { check_kernel_version(); _exit(0); } glibc-helpers-2.5.1-alt4.M41.2/post_ldconfig.c000064400000000000000000000014011167036546600206070ustar00rootroot00000000000000#include #include #include static int exec_wait (const char *path, const char *av[]) { pid_t pid = vfork (); if (pid < 0) return 1; if (!pid) { execv (path, (char *const *) av); _exit (1); } else { int status = 0; if (waitpid (pid, &status, 0) != pid || !WIFEXITED (status)) return 1; return WEXITSTATUS (status); } } int main (int argc, const char *argv[]) { int rc; const char *update_args[] = { "update_chrooted", "lib", 0 }; const char *ldconfig_args[] = { "ldconfig", 0 }; if (!getenv ("RPM_INSTALL_NAME") || getenv ("DURING_INSTALL")) return 0; if ((rc = exec_wait ("/sbin/ldconfig", ldconfig_args))) return rc; exec_wait ("/usr/sbin/update_chrooted", update_args); return 0; } glibc-helpers-2.5.1-alt4.M41.2/postun_ldconfig.c000064400000000000000000000006041167036546600211560ustar00rootroot00000000000000#include #include int main (int ac, const char *av[]) { const char *p; const char *ldconfig[] = { "ldconfig", 0 }; if (ac > 1) { if ((av[1][0] != '0') || (av[1][1] != '\0')) return 0; } else if ((p = getenv ("RPM_INSTALL_ARG1"))) { if ((p[0] != '0') || (p[1] != '\0')) return 0; } execv ("/sbin/ldconfig", (char *const *) ldconfig); return 1; }