Use finit API to get runlevel instead of utmp

utmp is not available with musl libc
This commit is contained in:
Patrick Stewart committed 2016-04-13 22:07:39 +01:00
1 parent f7f222c924
commit 1177c734ce
5 files changed
+42 -18

No files matched your search

-17
View File
@@ -58,23 +58,6 @@ void runlevel_set(int pre, int now)
endutent();
}
int runlevel_get(void)
{
int lvl = '?'; /* Non-existing runlevel */
struct utmp *utent;
setutent();
while ((utent = getutent())) {
if (utent->ut_type == RUN_LVL) {
lvl = utent->ut_pid & 0xFF;
break;
}
}
endutent();
return lvl - '0';
}
/**
* runlevel_string - Convert a bit encoded runlevel to .conf syntax
* @levels: Bit encoded runlevels