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
2021-03-05 12:36:48 +01:00
parent 774a24cdd8
commit 3ed291789c
5 changed files with 13 additions and 10 deletions
+4 -2
View File
@@ -58,7 +58,9 @@ static void do_list(const char *path)
glob_t gl;
size_t i;
chdir(path);
if (chdir(path))
return;
if (glob("*.conf", 0, NULL, &gl))
return;
@@ -213,7 +215,7 @@ int do_disable(char *arg, int check)
if (chdir(FINIT_RCSD))
err(1, "failed cd %s", FINIT_RCSD);
chdir("enabled"); /* System *may* have enabled/ dir. */
(void)chdir("enabled"); /* System *may* have enabled/ dir. */
if (check && stat(arg, &st))
errx(1, "%s not (an) enabled (service).", arg);