summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-05-31 16:56:00 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-06-02 08:15:27 -0400
commitb469f1e0fc5f0ac882161e627a1255ee11e67c37 (patch)
treeea5f4b46c4b6fbe58ded80930b2f5d0aae02d3d0 /doio.c
parent0c2c57a86cc6ec5688af5df66a8b8929f97ac491 (diff)
downloadperl-b469f1e0fc5f0ac882161e627a1255ee11e67c37.tar.gz
Use PERL_UNUSED_RESULT.
(1) Enhance its description. (2) Simplify it: define only if has warn_unused_result. (3) Make it use STMT_START { ... } STMT_END to be less GNU-extensiony. (4) Redo 04783dc7 ("fix 'ignoring return value' compiler warnings") with it.
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/doio.c b/doio.c
index 49d22695a0..3a09927c7d 100644
--- a/doio.c
+++ b/doio.c
@@ -978,16 +978,14 @@ Perl_nextargv(pTHX_ GV *gv)
(void)PerlLIO_chmod(PL_oldname,PL_filemode);
#endif
if (fileuid != PL_statbuf.st_uid || filegid != PL_statbuf.st_gid) {
- int rc = 0;
+ /* XXX silently ignore failures */
#ifdef HAS_FCHOWN
- rc = fchown(PL_lastfd,fileuid,filegid);
+ PERL_UNUSED_RESULT(fchown(PL_lastfd,fileuid,filegid));
#else
#ifdef HAS_CHOWN
- rc = PerlLIO_chown(PL_oldname,fileuid,filegid);
+ PERL_UNUSED_RESULT(PerlLIO_chown(PL_oldname,fileuid,filegid));
#endif
#endif
- /* XXX silently ignore failures */
- PERL_UNUSED_VAR(rc);
}
}
return IoIFP(GvIOp(gv));
@@ -1510,9 +1508,8 @@ S_exec_failed(pTHX_ const char *cmd, int fd, int do_report)
Perl_warner(aTHX_ packWARN(WARN_EXEC), "Can't exec \"%s\": %s",
cmd, Strerror(e));
if (do_report) {
- int rc = PerlLIO_write(fd, (void*)&e, sizeof(int));
- /* silently ignore failures */
- PERL_UNUSED_VAR(rc);
+ /* XXX silently ignore failures */
+ PERL_UNUSED_RESULT(PerlLIO_write(fd, (void*)&e, sizeof(int)));
PerlLIO_close(fd);
}
}