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:
Joachim Wiberg committed 2021-03-05 12:36:48 +01:00
1 parent 774a24cdd8
commit 3ed291789c
5 files changed
+13 -10

No files matched your search

+4 -3
View File
@@ -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("/");
}
}