From 36118e7dbd7b1ffb7326aa5e0a57ec61af6703d9 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 28 Aug 2007 08:50:04 +0000 Subject: Fix ksoftlevel handling, #190420. --- src/rc.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/rc.c b/src/rc.c index 1cb899a6..cdb8dd5b 100644 --- a/src/rc.c +++ b/src/rc.c @@ -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 () -- cgit v1.2.3