diff options
author | David Mitchell <davem@iabyn.com> | 2013-11-24 19:44:41 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-11-24 20:24:25 +0000 |
commit | 04783dc7025287c5d75ab531602c7ec786a1e787 (patch) | |
tree | 049174f15e0cc2c532f5e4b5b072a8fa42350df6 /doio.c | |
parent | 7616a0c2898b38b86404e7b0afa635e0bf786677 (diff) | |
download | perl-04783dc7025287c5d75ab531602c7ec786a1e787.tar.gz |
fix 'ignoring return value' compiler warnings
Various system functions like write() are marked with the
__warn_unused_result__ attribute, which causes an 'ignoring return value'
warning to be emitted, even if the function call result is cast to (void).
The generic solution seems to be
int rc = write(...);
PERL_UNUSED_VAR(rc);
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -879,13 +879,16 @@ 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; #ifdef HAS_FCHOWN - (void)fchown(PL_lastfd,fileuid,filegid); + rc = fchown(PL_lastfd,fileuid,filegid); #else #ifdef HAS_CHOWN - (void)PerlLIO_chown(PL_oldname,fileuid,filegid); + rc = PerlLIO_chown(PL_oldname,fileuid,filegid); #endif #endif + /* XXX silently ignore failures */ + PERL_UNUSED_VAR(rc); } } return IoIFP(GvIOp(gv)); @@ -1395,7 +1398,9 @@ 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) { - (void)PerlLIO_write(fd, (void*)&e, sizeof(int)); + int rc = PerlLIO_write(fd, (void*)&e, sizeof(int)); + /* silently ignore failures */ + PERL_UNUSED_VAR(rc); PerlLIO_close(fd); } } |