I've submitted startpar for review with Coverty, and it reported four issues on <URL: https://scan.coverity.com/projects/1719 >. But the project is not yet accepted, so I can not figure out which issues this is. So I had a look at building it with clang, and it found a few issues with ignored return values and using a GCC extention. The following patch get rid of all warnings from Clang, but I am unsure if this is the correct fix. Any comments?
The timerdiff() change make sense to me, but simply continuing to ignore exit values do not seem like a safe way forward. But I did not take the time to figure out why these exit values were ignored in the first place. Werner, do you remember? Index: startpar.c =================================================================== --- startpar.c (revision 178) +++ startpar.c (working copy) @@ -78,7 +78,11 @@ # define attribute(attr) __attribute__(attr) #endif -#define timerdiff(n,l) (extension({ (((n).tv_sec-(l).tv_sec)*1000)+(((n).tv_usec-(l).tv_usec)/1000); })) +long +timerdiff(const struct timeval n,const struct timeval l) +{ + return (((n).tv_sec-(l).tv_sec)*1000)+(((n).tv_usec-(l).tv_usec)/1000); +} typedef enum _boolean {false, true} boolean; extern char *optarg; @@ -190,7 +194,7 @@ int status; if (!splashpid) return; - TEMP_FAILURE_RETRY(waitpid(splashpid, &status, 0)); + (void)TEMP_FAILURE_RETRY(waitpid(splashpid, &status, 0)); } void closeall(void) @@ -258,7 +262,7 @@ (void)signal(SIGTTIN, SIG_DFL); (void)signal(SIGTTOU, SIG_DFL); - TEMP_FAILURE_RETRY(dup2(2, 1)); + (void)TEMP_FAILURE_RETRY(dup2(2, 1)); closeall(); execl("/sbin/splash", "splash", "-p", sbuf, "-t", tbuf, splashcfg, (char *)0); _exit(1); @@ -472,13 +476,13 @@ if (m && p->fd) { sigset_t smask, omask; - TEMP_FAILURE_RETRY(close(1)); + (void)TEMP_FAILURE_RETRY(close(1)); if (open(m, O_RDWR) != 1) { perror(m); _exit(1); } - TEMP_FAILURE_RETRY(dup2(1, 2)); + (void)TEMP_FAILURE_RETRY(dup2(1, 2)); sigemptyset(&smask); sigaddset(&smask, SIGTTOU); sigprocmask(SIG_BLOCK, &smask, &omask); @@ -492,7 +496,7 @@ } else { - TEMP_FAILURE_RETRY(dup2(2, 1)); + (void)TEMP_FAILURE_RETRY(dup2(2, 1)); } closeall(); @@ -591,7 +595,7 @@ (void)signal(SIGTTIN, SIG_DFL); (void)signal(SIGTTOU, SIG_DFL); - TEMP_FAILURE_RETRY(dup2(2, 1)); + (void)TEMP_FAILURE_RETRY(dup2(2, 1)); closeall(); if (run_mode) { @@ -607,7 +611,7 @@ _exit(1); } - TEMP_FAILURE_RETRY(waitpid(pid, &r, 0)); + (void)TEMP_FAILURE_RETRY(waitpid(pid, &r, 0)); callsplash(spl, prg, arg); return WIFEXITED(r) ? WEXITSTATUS(r) : (WIFSIGNALED(r) ? 1 : 255); } @@ -734,8 +738,8 @@ (void)signal(SIGTTIN, SIG_DFL); (void)signal(SIGTTOU, SIG_DFL); - TEMP_FAILURE_RETRY(dup2(p->fd, 0)); - TEMP_FAILURE_RETRY(dup2(2, 1)); + (void)TEMP_FAILURE_RETRY(dup2(p->fd, 0)); + (void)TEMP_FAILURE_RETRY(dup2(2, 1)); closeall(); execlp(myname, myname, "-f", "--", p->name, NULL); -- Happy hacking Petter Reinholdtsen