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 # ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2 # 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>: 26 Aug 2007; Mike Frysinger <vapier@gentoo.org>:
Add /etc/gentoo-release to CONFIG_PROTECT_MASK. Add /etc/gentoo-release to CONFIG_PROTECT_MASK.

View File

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