Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 347498 Details for
Bug 468736
sys-apps/openrc - RC_DEFAULTLEVEL variable has incorrect value if default runlevel is not default or softlevel is specified on the kernel command line
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Patch to resolve incorrect RC_DEFAULTLEVEL values
openrc-0.11.8-default_runlevel.patch (text/plain), 2.67 KB, created by
Max Hacking
on 2013-05-06 08:26:06 UTC
(
hide
)
Description:
Patch to resolve incorrect RC_DEFAULTLEVEL values
Filename:
MIME Type:
Creator:
Max Hacking
Created:
2013-05-06 08:26:06 UTC
Size:
2.67 KB
patch
obsolete
>--- openrc-0.11.8.orig/src/includes/rc-misc.h 2012-12-07 16:53:28.000000000 +0100 >+++ openrc-0.11.8/src/includes/rc-misc.h 2013-05-05 02:55:51.017095355 +0200 >@@ -41,7 +41,6 @@ > #include "helpers.h" > > #define RC_LEVEL_BOOT "boot" >-#define RC_LEVEL_DEFAULT "default" > > #define RC_DEPTREE_CACHE RC_SVCDIR "/deptree" > #define RC_DEPTREE_SKEWED RC_SVCDIR "/clock-skewed" >@@ -54,6 +53,8 @@ > #define RC_SVCDIR_STARTED RC_SVCDIR "/started" > #define RC_SVCDIR_COLDPLUGGED RC_SVCDIR "/coldplugged" > >+#define INITTAB "/etc/inittab" >+ > _unused static bool exists(const char *pathname) > { > struct stat buf; >--- openrc-0.11.8.orig/src/rc/rc-misc.c 2012-12-07 16:53:28.000000000 +0100 >+++ openrc-0.11.8/src/rc/rc-misc.c 2013-05-05 14:55:10.690745728 +0200 >@@ -139,6 +139,10 @@ > char *tok; > const char *sys = rc_sys(); > char buffer[PATH_MAX]; >+ int done = 0; >+ char default_run_level = 0; >+ char *id, *rlevel, *action, *process; >+ char *dummy, *runlevelname; > > /* Ensure our PATH is prefixed with the system locations first > for a little extra security */ >@@ -176,17 +180,57 @@ > setenv("RC_RUNLEVEL", e, 1); > free(e); > >+ /* Set the RC_KRUNLEVEL variable to the runlevel specified on the >+ * kernel command line, if any. */ > if ((fp = fopen(RC_KRUNLEVEL, "r"))) { > memset(buffer, 0, sizeof (buffer)); > if (fgets(buffer, sizeof (buffer), fp)) { > l = strlen (buffer) - 1; > if (buffer[l] == '\n') > buffer[l] = 0; >- setenv("RC_DEFAULTLEVEL", buffer, 1); >+ setenv("RC_KRUNLEVEL", buffer, 1); > } > fclose(fp); >- } else >- setenv("RC_DEFAULTLEVEL", RC_LEVEL_DEFAULT, 1); >+ } >+ >+ /* Read the default runlevel from inittab */ >+ runlevelname = NULL; >+ if ((fp = fopen(INITTAB, "r"))) { >+ memset(buffer, 0, sizeof (buffer)); >+ >+ while ((!done) && (fgets(buffer, sizeof (buffer), fp))) { >+ for(p = buffer; *p == ' ' || *p == '\t'; p++) >+ ; >+ if (*p == '#' || *p == '\n') continue; >+ >+ id = strsep(&p, ":"); >+ rlevel = strsep(&p, ":"); >+ action = strsep(&p, ":"); >+ process = strsep(&p, "\n"); >+ >+ if ((default_run_level == 0) && (action != NULL)) { >+ if (strcmp(action, "initdefault") == 0) >+ default_run_level = rlevel[0]; >+ } >+ else { >+ if ((strchr(rlevel, default_run_level) != NULL) && (strcmp(action, "wait") == 0)) { >+ >+ dummy = strsep(&process, " "); >+ runlevelname = strsep(&process, "\n"); >+ >+ if (runlevelname != NULL) { >+ done = 1; >+ setenv("RC_DEFAULTLEVEL", runlevelname, 1); >+ } >+ } >+ } >+ } >+ fclose(fp); >+ } >+ >+ /* If we still didn't find the default runlevel use default and hope! */ >+ if (runlevelname == NULL) >+ setenv("RC_DEFAULTLEVEL", "default", 1); > > if (sys) > setenv("RC_SYS", sys, 1);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 468736
: 347498