mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 13:33:09 +07:00
Fix GCC warnings for unhandled return value
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+6
-3
@@ -462,7 +462,8 @@ int mksubsys(const char *dir, mode_t mode, char *user, char *group)
|
||||
gid = 0;
|
||||
|
||||
rc = makedir(dir, mode);
|
||||
(void)chown(dir, uid, gid);
|
||||
if (chown(dir, uid, gid))
|
||||
_pe("Failed chown(%s, %d, %d)", dir, uid, gid);
|
||||
}
|
||||
|
||||
umask(omask);
|
||||
@@ -498,8 +499,10 @@ void set_hostname(char **hostname)
|
||||
}
|
||||
|
||||
done:
|
||||
if (*hostname)
|
||||
(void)sethostname(*hostname, strlen(*hostname));
|
||||
if (*hostname) {
|
||||
if (sethostname(*hostname, strlen(*hostname)))
|
||||
_pe("Failed sethostnaem(%s)", *hostname);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+10
-5
@@ -402,19 +402,24 @@ static pid_t service_fork(svc_t *svc)
|
||||
}
|
||||
|
||||
/* Set desired user+group */
|
||||
if (gid >= 0)
|
||||
(void)setgid(gid);
|
||||
if (gid >= 0) {
|
||||
if (setgid(gid))
|
||||
_pe("%s: failed setgid(%d)", svc->cmd, gid);
|
||||
}
|
||||
|
||||
if (uid >= 0) {
|
||||
(void)setuid(uid);
|
||||
if (setuid(uid))
|
||||
_pe("%s: failed setuid(%d)", svc->cmd, uid);
|
||||
|
||||
/* Set default path for regular users */
|
||||
if (uid > 0)
|
||||
setenv("PATH", _PATH_DEFPATH, 1);
|
||||
if (home) {
|
||||
setenv("HOME", home, 1);
|
||||
if (chdir(home))
|
||||
(void)chdir("/");
|
||||
if (chdir(home)) {
|
||||
if (chdir("/"))
|
||||
_pe("%s: failed chdir(%s) and chdir(/)", svc->cmd, home);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user