Silence gcc 7.5.0 warning about ignoring return value

menus.cc: In function ‘void Execute(const char*)’:
menus.cc:2199:5: error: ignoring return value of ‘int system(const char*)’, declared with attribute warn_unused_result [-Werror=unused-result]
     (void) system (s);
This commit is contained in:
Michael Small 2021-02-23 13:21:48 -05:00
parent 5d1c9ebee6
commit cbc7afb302
1 changed files with 3 additions and 1 deletions

View File

@ -2196,7 +2196,9 @@ Execute(const char *s)
restorevar = 1;
}
(void) system (s);
int rc{system(s)};
if (rc == -1)
fprintf(stderr, "%s: %s failed to run\n", ProgramName, s);
if (restorevar) { /* why bother? */
(void) snprintf (buf, sizeof(buf), "DISPLAY=%s", oldDisplay);