]> granicus.if.org Git - sudo/commitdiff
Fix compiler warnings on some platforms and provide a better method
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 16 May 2012 19:50:42 +0000 (15:50 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 16 May 2012 19:50:42 +0000 (15:50 -0400)
of defeating gcc's warn_unused_result attribute.

--HG--
branch : 1.7

config.h.in
configure.in
exec.c
exec_pty.c
iolog.c
tgetpass.c
toke.c
toke.l
visudo.c

index 5372a1fbb1fb3484ad598627a87271eeb14a24ab..e313da8e9e05868736453fe0ab8afb599f6d933b 100644 (file)
 # endif
 #endif
 
+#ifdef __GNUC__
+# define ignore_result(x) do {                                                \
+    __typeof__(x) y = (x);                                                    \
+    (void)y;                                                                  \
+} while(0)
+#else
+# define ignore_result(x)      (void)(x)
+#endif
+
 /* GNU stow needs /etc/sudoers to be a symlink. */
 #ifdef USE_STOW
 # define stat_sudoers  stat
index fbc4c4f217daf2bffa3d3433de3e66ccc97cbc19..bacbebc25a851032ffcb7d3c9269ad1bf4f3dbe7 100644 (file)
@@ -3211,6 +3211,15 @@ AH_BOTTOM([/*
 # endif
 #endif
 
+#ifdef __GNUC__
+# define ignore_result(x) do {                                                \
+    __typeof__(x) y = (x);                                                    \
+    (void)y;                                                                  \
+} while(0)
+#else
+# define ignore_result(x)      (void)(x)
+#endif
+
 /* GNU stow needs /etc/sudoers to be a symlink. */
 #ifdef USE_STOW
 # define stat_sudoers  stat
diff --git a/exec.c b/exec.c
index 9d9572a44d7bf8e64da498fd728fde561d17e7d8..6bb984000664ef9d1679b5dc7effc10bf538f444 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -641,8 +641,7 @@ handler(s)
      * The pipe is non-blocking, if we overflow the kernel's pipe
      * buffer we drop the signal.  This is not a problem in practice.
      */
-    if (write(signal_pipe[1], &signo, sizeof(signo)) == -1)
-       /* shut up glibc */;
+    ignore_result(write(signal_pipe[1], &signo, sizeof(signo)));
 }
 
 #ifdef SA_SIGINFO
@@ -666,8 +665,7 @@ handler_nofwd(s, info, context)
         * The pipe is non-blocking, if we overflow the kernel's pipe
         * buffer we drop the signal.  This is not a problem in practice.
         */
-       if (write(signal_pipe[1], &signo, sizeof(signo)) == -1)
-           /* shut up glibc */;
+       ignore_result(write(signal_pipe[1], &signo, sizeof(signo)));
     }
 }
 #endif /* SA_SIGINFO */
index ee26aa1ffa78c82fdf7fb49b425ed59b69e76f9e..7e1a05a81c54d666f5859b5a856a3f566b212549 100644 (file)
@@ -539,11 +539,9 @@ pty_close(cstat)
                io_fds[SFD_USERTTY] : STDOUT_FILENO;
            if (write(n, reason, strlen(reason)) != -1) {
                if (WCOREDUMP(cstat->val)) {
-                   if (write(n, " (core dumped)", 14) == -1)
-                       /* shut up glibc */;
+                   ignore_result(write(n, " (core dumped)", 14));
                }
-               if (write(n, "\n", 1) == -1)
-                   /* shut up glibc */;
+               ignore_result(write(n, "\n", 1));
            }
        }
     }
@@ -796,8 +794,7 @@ exec_monitor(path, argv, envp, backchannel, rbac)
        exec_pty(path, argv, envp, rbac, &errpipe[1]);
        cstat.type = CMD_ERRNO;
        cstat.val = errno;
-       if (write(errpipe[1], &cstat, sizeof(cstat)) == -1)
-           /* shut up glibc */;
+       ignore_result(write(errpipe[1], &cstat, sizeof(cstat)));
        _exit(1);
     }
     close(errpipe[1]);
diff --git a/iolog.c b/iolog.c
index e6fb5997d36087d1aaf628446eec8c71350d9f99..f69eb10022b3fb3822966da9cd989d719ffe04f0 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -330,10 +330,10 @@ log_io(buf, len, idx)
 
 #ifdef HAVE_ZLIB_H
     if (def_compress_io)
-       gzwrite(io_fds[idx].g, buf, len);
+       ignore_result(gzwrite(io_fds[idx].g, (const voidp)buf, len));
     else
 #endif
-       fwrite(buf, 1, len, io_fds[idx].f);
+       ignore_result(fwrite(buf, 1, len, io_fds[idx].f));
     delay.tv_sec = now.tv_sec;
     delay.tv_usec = now.tv_usec;
     timevalsub(&delay, &last_time);
index c1926a01769a982bc8e74dc946281182b99213b2..446ce10bd5e0420b97ca081ddd3818ce8d2bee14 100644 (file)
@@ -275,8 +275,7 @@ getln(fd, buf, bufsiz, feedback)
                }
                continue;
            }
-           if (write(fd, "*", 1) == -1)
-               /* shut up glibc */;
+           ignore_result(write(fd, "*", 1));
        }
        *cp++ = c;
     }
diff --git a/toke.c b/toke.c
index 852cb7e22b1c526a7dd7f1e72f505b13fad603d4..176ecb81a1f37375d313c6ca181031a7b5bd9ff7 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1484,6 +1484,8 @@ char *sudoers;
 
 static int continued, prev_state, sawspace;
 
+#define ECHO   ignore_result(fwrite(yytext, yyleng, 1, yyout))
+
 static int _push_include       __P((char *, int));
 static int pop_include         __P((void));
 static char *parse_include     __P((char *));
@@ -1515,7 +1517,7 @@ static char *parse_include        __P((char *));
 
 #define INSTR 5
 
-#line 1518 "lex.yy.c"
+#line 1520 "lex.yy.c"
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -1669,9 +1671,9 @@ YY_DECL
        register char *yy_cp, *yy_bp;
        register int yy_act;
 
-#line 126 "toke.l"
+#line 128 "toke.l"
 
-#line 1674 "lex.yy.c"
+#line 1676 "lex.yy.c"
 
        if ( yy_init )
                {
@@ -1757,7 +1759,7 @@ do_action:        /* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 127 "toke.l"
+#line 129 "toke.l"
 {
                            LEXTRACE(", ");
                            LEXRETURN(',');
@@ -1765,12 +1767,12 @@ YY_RULE_SETUP
        YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 132 "toke.l"
+#line 134 "toke.l"
 BEGIN STARTDEFS;
        YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 134 "toke.l"
+#line 136 "toke.l"
 {
                            BEGIN INDEFS;
                            LEXTRACE("DEFVAR ");
@@ -1782,7 +1784,7 @@ YY_RULE_SETUP
 
 case 4:
 YY_RULE_SETUP
-#line 143 "toke.l"
+#line 145 "toke.l"
 {
                            BEGIN STARTDEFS;
                            LEXTRACE(", ");
@@ -1791,7 +1793,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 149 "toke.l"
+#line 151 "toke.l"
 {
                            LEXTRACE("= ");
                            LEXRETURN('=');
@@ -1799,7 +1801,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 154 "toke.l"
+#line 156 "toke.l"
 {
                            LEXTRACE("+= ");
                            LEXRETURN('+');
@@ -1807,7 +1809,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 159 "toke.l"
+#line 161 "toke.l"
 {
                            LEXTRACE("-= ");
                            LEXRETURN('-');
@@ -1815,7 +1817,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 164 "toke.l"
+#line 166 "toke.l"
 {
                            LEXTRACE("BEGINSTR ");
                            yylval.string = NULL;
@@ -1825,7 +1827,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 171 "toke.l"
+#line 173 "toke.l"
 {
                            LEXTRACE("WORD(2) ");
                            if (!fill(yytext, yyleng))
@@ -1837,7 +1839,7 @@ YY_RULE_SETUP
 
 case 10:
 YY_RULE_SETUP
-#line 180 "toke.l"
+#line 182 "toke.l"
 {
                            /* Line continuation char followed by newline. */
                            sudolineno++;
@@ -1846,7 +1848,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 186 "toke.l"
+#line 188 "toke.l"
 {
                            LEXTRACE("ENDSTR ");
                            BEGIN prev_state;
@@ -1881,7 +1883,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 218 "toke.l"
+#line 220 "toke.l"
 {
                            LEXTRACE("BACKSLASH ");
                            if (!append(yytext, yyleng))
@@ -1890,7 +1892,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 224 "toke.l"
+#line 226 "toke.l"
 {
                            LEXTRACE("STRBODY ");
                            if (!append(yytext, yyleng))
@@ -1901,7 +1903,7 @@ YY_RULE_SETUP
 
 case 14:
 YY_RULE_SETUP
-#line 232 "toke.l"
+#line 234 "toke.l"
 {
                            /* quoted fnmatch glob char, pass verbatim */
                            LEXTRACE("QUOTEDCHAR ");
@@ -1912,7 +1914,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 240 "toke.l"
+#line 242 "toke.l"
 {
                            /* quoted sudoers special char, strip backslash */
                            LEXTRACE("QUOTEDCHAR ");
@@ -1923,7 +1925,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 248 "toke.l"
+#line 250 "toke.l"
 {
                            BEGIN INITIAL;
                            yyless(0);
@@ -1932,7 +1934,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 254 "toke.l"
+#line 256 "toke.l"
 {
                            LEXTRACE("ARG ");
                            if (!fill_args(yytext, yyleng, sawspace))
@@ -1943,7 +1945,7 @@ YY_RULE_SETUP
 
 case 18:
 YY_RULE_SETUP
-#line 262 "toke.l"
+#line 264 "toke.l"
 {
                            char *path;
 
@@ -1964,7 +1966,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 280 "toke.l"
+#line 282 "toke.l"
 {
                            char *path;
 
@@ -1988,7 +1990,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 301 "toke.l"
+#line 303 "toke.l"
 {
                            char deftype;
                            int n;
@@ -2031,7 +2033,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 341 "toke.l"
+#line 343 "toke.l"
 {
                            int n;
 
@@ -2060,7 +2062,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 367 "toke.l"
+#line 369 "toke.l"
 {
                                /* cmnd does not require passwd for this user */
                                LEXTRACE("NOPASSWD ");
@@ -2069,7 +2071,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 373 "toke.l"
+#line 375 "toke.l"
 {
                                /* cmnd requires passwd for this user */
                                LEXTRACE("PASSWD ");
@@ -2078,7 +2080,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 379 "toke.l"
+#line 381 "toke.l"
 {
                                LEXTRACE("NOEXEC ");
                                LEXRETURN(NOEXEC);
@@ -2086,7 +2088,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 384 "toke.l"
+#line 386 "toke.l"
 {
                                LEXTRACE("EXEC ");
                                LEXRETURN(EXEC);
@@ -2094,7 +2096,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 389 "toke.l"
+#line 391 "toke.l"
 {
                                LEXTRACE("SETENV ");
                                LEXRETURN(SETENV);
@@ -2102,7 +2104,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 394 "toke.l"
+#line 396 "toke.l"
 {
                                LEXTRACE("NOSETENV ");
                                LEXRETURN(NOSETENV);
@@ -2110,7 +2112,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 399 "toke.l"
+#line 401 "toke.l"
 {
                                LEXTRACE("LOG_OUTPUT ");
                                LEXRETURN(LOG_OUTPUT);
@@ -2118,7 +2120,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 404 "toke.l"
+#line 406 "toke.l"
 {
                                LEXTRACE("NOLOG_OUTPUT ");
                                LEXRETURN(NOLOG_OUTPUT);
@@ -2126,7 +2128,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 409 "toke.l"
+#line 411 "toke.l"
 {
                                LEXTRACE("LOG_INPUT ");
                                LEXRETURN(LOG_INPUT);
@@ -2134,7 +2136,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 414 "toke.l"
+#line 416 "toke.l"
 {
                                LEXTRACE("NOLOG_INPUT ");
                                LEXRETURN(NOLOG_INPUT);
@@ -2142,7 +2144,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 419 "toke.l"
+#line 421 "toke.l"
 {
                            /* empty group or netgroup */
                            LEXTRACE("ERROR ");
@@ -2151,7 +2153,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 425 "toke.l"
+#line 427 "toke.l"
 {
                            /* netgroup */
                            if (!fill(yytext, yyleng))
@@ -2162,7 +2164,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 433 "toke.l"
+#line 435 "toke.l"
 {
                            /* group */
                            if (!fill(yytext, yyleng))
@@ -2173,7 +2175,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 441 "toke.l"
+#line 443 "toke.l"
 {
                            if (!fill(yytext, yyleng))
                                yyterminate();
@@ -2183,7 +2185,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 448 "toke.l"
+#line 450 "toke.l"
 {
                            if (!fill(yytext, yyleng))
                                yyterminate();
@@ -2193,7 +2195,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 455 "toke.l"
+#line 457 "toke.l"
 {
                            if (!ipv6_valid(yytext)) {
                                LEXTRACE("ERROR ");
@@ -2207,7 +2209,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 466 "toke.l"
+#line 468 "toke.l"
 {
                            if (!ipv6_valid(yytext)) {
                                LEXTRACE("ERROR ");
@@ -2221,7 +2223,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 477 "toke.l"
+#line 479 "toke.l"
 {
                            LEXTRACE("ALL ");
                            LEXRETURN(ALL);
@@ -2230,7 +2232,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 483 "toke.l"
+#line 485 "toke.l"
 {
 #ifdef HAVE_SELINUX
                            LEXTRACE("ROLE ");
@@ -2242,7 +2244,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 492 "toke.l"
+#line 494 "toke.l"
 {
 #ifdef HAVE_SELINUX
                            LEXTRACE("TYPE ");
@@ -2254,7 +2256,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 501 "toke.l"
+#line 503 "toke.l"
 {
 #ifndef HAVE_SELINUX
                        got_alias:
@@ -2267,7 +2269,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 511 "toke.l"
+#line 513 "toke.l"
 {
                            /* no command args allowed for Defaults!/path */
                            if (!fill_cmnd(yytext, yyleng))
@@ -2278,7 +2280,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 44:
 YY_RULE_SETUP
-#line 519 "toke.l"
+#line 521 "toke.l"
 {
                            BEGIN GOTCMND;
                            LEXTRACE("COMMAND ");
@@ -2288,7 +2290,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 526 "toke.l"
+#line 528 "toke.l"
 {
                            /* directories can't have args... */
                            if (yytext[yyleng - 1] == '/') {
@@ -2306,7 +2308,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 541 "toke.l"
+#line 543 "toke.l"
 {
                            LEXTRACE("BEGINSTR ");
                            yylval.string = NULL;
@@ -2316,7 +2318,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 47:
 YY_RULE_SETUP
-#line 548 "toke.l"
+#line 550 "toke.l"
 {
                            /* a word */
                            if (!fill(yytext, yyleng))
@@ -2327,7 +2329,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 556 "toke.l"
+#line 558 "toke.l"
 {
                            LEXTRACE("( ");
                            LEXRETURN('(');
@@ -2335,7 +2337,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 49:
 YY_RULE_SETUP
-#line 561 "toke.l"
+#line 563 "toke.l"
 {
                            LEXTRACE(") ");
                            LEXRETURN(')');
@@ -2343,7 +2345,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 566 "toke.l"
+#line 568 "toke.l"
 {
                            LEXTRACE(", ");
                            LEXRETURN(',');
@@ -2351,7 +2353,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 51:
 YY_RULE_SETUP
-#line 571 "toke.l"
+#line 573 "toke.l"
 {
                            LEXTRACE("= ");
                            LEXRETURN('=');
@@ -2359,7 +2361,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 52:
 YY_RULE_SETUP
-#line 576 "toke.l"
+#line 578 "toke.l"
 {
                            LEXTRACE(": ");
                            LEXRETURN(':');
@@ -2367,7 +2369,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 581 "toke.l"
+#line 583 "toke.l"
 {
                            if (yyleng & 1) {
                                LEXTRACE("!");
@@ -2377,7 +2379,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 54:
 YY_RULE_SETUP
-#line 588 "toke.l"
+#line 590 "toke.l"
 {
                            if (YY_START == INSTR) {
                                LEXTRACE("ERROR ");
@@ -2392,14 +2394,14 @@ YY_RULE_SETUP
        YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 600 "toke.l"
+#line 602 "toke.l"
 {                      /* throw away space/tabs */
                            sawspace = TRUE;    /* but remember for fill_args */
                        }
        YY_BREAK
 case 56:
 YY_RULE_SETUP
-#line 604 "toke.l"
+#line 606 "toke.l"
 {
                            sawspace = TRUE;    /* remember for fill_args */
                            sudolineno++;
@@ -2408,7 +2410,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 57:
 YY_RULE_SETUP
-#line 610 "toke.l"
+#line 612 "toke.l"
 {
                            BEGIN INITIAL;
                            sudolineno++;
@@ -2419,7 +2421,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 58:
 YY_RULE_SETUP
-#line 618 "toke.l"
+#line 620 "toke.l"
 {
                            LEXTRACE("ERROR ");
                            LEXRETURN(ERROR);
@@ -2431,7 +2433,7 @@ case YY_STATE_EOF(GOTCMND):
 case YY_STATE_EOF(STARTDEFS):
 case YY_STATE_EOF(INDEFS):
 case YY_STATE_EOF(INSTR):
-#line 623 "toke.l"
+#line 625 "toke.l"
 {
                            if (YY_START != INITIAL) {
                                BEGIN INITIAL;
@@ -2444,10 +2446,10 @@ case YY_STATE_EOF(INSTR):
        YY_BREAK
 case 59:
 YY_RULE_SETUP
-#line 633 "toke.l"
+#line 635 "toke.l"
 ECHO;
        YY_BREAK
-#line 2450 "lex.yy.c"
+#line 2452 "lex.yy.c"
 
        case YY_END_OF_BUFFER:
                {
@@ -3338,7 +3340,7 @@ int main()
        return 0;
        }
 #endif
-#line 633 "toke.l"
+#line 635 "toke.l"
 
 struct path_list {
     char *path;
diff --git a/toke.l b/toke.l
index e95fb18f7b867df459765dacc95969af21e99232..da10f694aaa77a0d4f236e2ce8742dc1356d29d1 100644 (file)
--- a/toke.l
+++ b/toke.l
@@ -80,6 +80,8 @@ char *sudoers;
 
 static int continued, prev_state, sawspace;
 
+#define ECHO   ignore_result(fwrite(yytext, yyleng, 1, yyout))
+
 static int _push_include       __P((char *, int));
 static int pop_include         __P((void));
 static char *parse_include     __P((char *));
index f7c36523ff7b270dbbb6b56940cf7e90b8fa5677..bfdaf83c9b9a922f7ae115e6ad762ecf0f0f89cc 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -538,9 +538,9 @@ install_sudoers(sp, oldperms)
        (void) unlink(sp->tpath);
        if (!oldperms && fstat(sp->fd, &sb) != -1) {
            if (sb.st_uid != SUDOERS_UID || sb.st_gid != SUDOERS_GID)
-               (void) chown(sp->path, SUDOERS_UID, SUDOERS_GID);
+               ignore_result(chown(sp->path, SUDOERS_UID, SUDOERS_GID));
            if ((sb.st_mode & 0777) != SUDOERS_MODE)
-               (void) chmod(sp->path, SUDOERS_MODE);
+               ignore_result(chmod(sp->path, SUDOERS_MODE));
        }
        return TRUE;
     }
@@ -1249,9 +1249,8 @@ quit(signo)
 {
     cleanup(signo);
 #define        emsg     " exiting due to signal.\n"
-    if (write(STDERR_FILENO, getprogname(), strlen(getprogname())) == -1 ||
-       write(STDERR_FILENO, emsg, sizeof(emsg) - 1) == -1)
-       /* shut up glibc */;
+    ignore_result(write(STDERR_FILENO, getprogname(), strlen(getprogname())));
+    ignore_result(write(STDERR_FILENO, emsg, sizeof(emsg) - 1));
     _exit(signo);
 }