Do not run telinit u on upgrades (#1579225)

This commit is contained in:
Florian Weimer 2018-05-17 10:31:38 +02:00
parent 123bb3ec74
commit a50c0ee87a

View File

@ -165,33 +165,6 @@ main (void)
"--nostdlib", iconv_dir); "--nostdlib", iconv_dir);
} }
/* Check if telinit is available and either SysVInit fifo,
or upstart telinit. */
if (access ("/sbin/telinit", X_OK)
|| ((!!access ("/dev/initctl", F_OK))
^ !access ("/sbin/initctl", X_OK)))
_exit (0);
/* Check if we are not inside of some chroot, because we'd just
timeout and leave /etc/initrunlvl.
On more modern systems this test is not sufficient to detect
if we're in a chroot. */
if (readlink ("/proc/1/exe", initpath, 256) <= 0 ||
readlink ("/proc/1/root", initpath, 256) <= 0)
_exit (0);
/* Here's another well known way to detect chroot, at least on an
ext and xfs filesystems and assuming nothing mounted on the chroot's
root. */
if (stat ("/", &statbuf) != 0
|| (statbuf.st_ino != 2
&& statbuf.st_ino != 128))
_exit (0);
if (check_elf ("/proc/1/exe"))
verbose_exec (116, "/sbin/telinit", "/sbin/telinit", "u");
_exit(0); _exit(0);
} }