Fix ksoftlevel handling, #190420.

This commit is contained in:
Roy Marples 2007-08-28 08:50:04 +00:00
parent 2845610fa6
commit 36118e7dbd
2 changed files with 16 additions and 12 deletions

View File

@ -1,6 +1,10 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
28 Aug 2007; Roy Marples <uberlord@gentoo.org>:
Fix ksoftlevel handling, #190420.
26 Aug 2007; Mike Frysinger <vapier@gentoo.org>:
Add /etc/gentoo-release to CONFIG_PROTECT_MASK.

View File

@ -45,6 +45,7 @@
#define HALTSH RC_INITDIR "/halt.sh"
#define SULOGIN "/sbin/sulogin"
#define KSOFTLEVEL RC_SVCDIR "/ksoftlevel"
#define INTERACTIVE RC_SVCDIR "/interactive"
#define DEVBOOT "/dev/.rcboot"
@ -542,14 +543,14 @@ static void set_ksoftlevel (const char *runlevel)
strcmp (runlevel, RC_LEVEL_SINGLE) == 0 ||
strcmp (runlevel, RC_LEVEL_SYSINIT) == 0)
{
if (rc_exists (RC_SVCDIR "ksoftlevel") &&
unlink (RC_SVCDIR "ksoftlevel") != 0)
eerror ("unlink `%s': %s", RC_SVCDIR "ksoftlevel", strerror (errno));
if (rc_exists (KSOFTLEVEL) &&
unlink (KSOFTLEVEL) != 0)
eerror ("unlink `%s': %s", KSOFTLEVEL, strerror (errno));
return;
}
if (! (fp = fopen (RC_SVCDIR "ksoftlevel", "w"))) {
eerror ("fopen `%s': %s", RC_SVCDIR "ksoftlevel", strerror (errno));
if (! (fp = fopen (KSOFTLEVEL, "w"))) {
eerror ("fopen `%s': %s", KSOFTLEVEL, strerror (errno));
return;
}
@ -562,13 +563,12 @@ static int get_ksoftlevel (char *buffer, int buffer_len)
FILE *fp;
int i = 0;
if (! rc_exists (RC_SVCDIR "ksoftlevel"))
return 0;
if (! rc_exists (KSOFTLEVEL))
return (0);
if (! (fp = fopen (RC_SVCDIR "ksoftlevel", "r"))) {
eerror ("fopen `%s': %s", RC_SVCDIR "ksoftlevel",
strerror (errno));
return -1;
if (! (fp = fopen (KSOFTLEVEL, "r"))) {
eerror ("fopen `%s': %s", KSOFTLEVEL, strerror (errno));
return (-1);
}
if (fgets (buffer, buffer_len, fp)) {
@ -578,7 +578,7 @@ static int get_ksoftlevel (char *buffer, int buffer_len)
}
fclose (fp);
return i;
return (i);
}
static void wait_for_services ()