mirror of
https://github.com/troglobit/finit.git
synced 2026-10-29 12:40:44 +00:00
Fix GCC warnings for unhandled return value
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
23a13fe1b6
commit
be5ec94fdf
2 files changed
+16
-8
No files matched your search
+6
-3
@@ -462,7 +462,8 @@ int mksubsys(const char *dir, mode_t mode, char *user, char *group)
|
|||||||
gid = 0;
|
gid = 0;
|
||||||
|
|
||||||
rc = makedir(dir, mode);
|
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);
|
umask(omask);
|
||||||
@@ -498,8 +499,10 @@ void set_hostname(char **hostname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (*hostname)
|
if (*hostname) {
|
||||||
(void)sethostname(*hostname, strlen(*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 */
|
/* Set desired user+group */
|
||||||
if (gid >= 0)
|
if (gid >= 0) {
|
||||||
(void)setgid(gid);
|
if (setgid(gid))
|
||||||
|
_pe("%s: failed setgid(%d)", svc->cmd, gid);
|
||||||
|
}
|
||||||
|
|
||||||
if (uid >= 0) {
|
if (uid >= 0) {
|
||||||
(void)setuid(uid);
|
if (setuid(uid))
|
||||||
|
_pe("%s: failed setuid(%d)", svc->cmd, uid);
|
||||||
|
|
||||||
/* Set default path for regular users */
|
/* Set default path for regular users */
|
||||||
if (uid > 0)
|
if (uid > 0)
|
||||||
setenv("PATH", _PATH_DEFPATH, 1);
|
setenv("PATH", _PATH_DEFPATH, 1);
|
||||||
if (home) {
|
if (home) {
|
||||||
setenv("HOME", home, 1);
|
setenv("HOME", home, 1);
|
||||||
if (chdir(home))
|
if (chdir(home)) {
|
||||||
(void)chdir("/");
|
if (chdir("/"))
|
||||||
|
_pe("%s: failed chdir(%s) and chdir(/)", svc->cmd, home);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user