mirror of
https://github.com/troglobit/finit.git
synced 2026-10-17 10:49:34 +00:00
Fix GCC warnings with _FORTIFY_SOURCE=2
- Decleare some return values with (void)fn(), for cases where we don't care (dropping table headers), or best effor - Check return value from fgets() and chdir() in some cases that are valid, i.e., continuing execution is pointless Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
774a24cdd8
commit
3ed291789c
5 files changed
+13
-10
No files matched your search
+4
-3
@@ -464,17 +464,18 @@ static int service_start(svc_t *svc)
|
||||
|
||||
/* Set desired user+group */
|
||||
if (gid >= 0)
|
||||
setgid(gid);
|
||||
(void)setgid(gid);
|
||||
|
||||
if (uid >= 0) {
|
||||
setuid(uid);
|
||||
(void)setuid(uid);
|
||||
|
||||
/* Set default path for regular users */
|
||||
if (uid > 0)
|
||||
setenv("PATH", _PATH_DEFPATH, 1);
|
||||
if (home) {
|
||||
setenv("HOME", home, 1);
|
||||
chdir(home);
|
||||
if (chdir(home))
|
||||
(void)chdir("/");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user