mirror of
https://github.com/troglobit/finit.git
synced 2026-11-03 13:28:27 +00:00
svc.c - Break out nested function.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
327ac9f931
commit
22ed4e7f73
1 file changed
+8
-6
@@ -143,16 +143,18 @@ void svc_bootstrap(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int encode(int lvl)
|
||||||
|
{
|
||||||
|
if (!lvl)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return lvl + '0';
|
||||||
|
}
|
||||||
|
|
||||||
static void utmp_save(int pre, int now)
|
static void utmp_save(int pre, int now)
|
||||||
{
|
{
|
||||||
struct utmp utent;
|
struct utmp utent;
|
||||||
|
|
||||||
int encode(int lvl)
|
|
||||||
{
|
|
||||||
if (!lvl) return 0;
|
|
||||||
return lvl + '0';
|
|
||||||
}
|
|
||||||
|
|
||||||
utent.ut_type = RUN_LVL;
|
utent.ut_type = RUN_LVL;
|
||||||
utent.ut_pid = (encode(pre) << 8) | (encode(now) & 0xFF);
|
utent.ut_pid = (encode(pre) << 8) | (encode(now) & 0xFF);
|
||||||
strlcpy(utent.ut_user, "runlevel", sizeof(utent.ut_user));
|
strlcpy(utent.ut_user, "runlevel", sizeof(utent.ut_user));
|
||||||
|
|||||||
Reference in new issue
Block a user