xfsdump: fix system() error reporting
PATCH 1/1 xfsdump: fix system() error reporting
Positive returns from system need the WEXITSTATUS macro applies to get the real exit code of the executed command.
Based on analysis in oss BZ #804.
dump/content.c +2 -1
@@ -6735,7 +6735,8 @@ save_quotas( char *mntpnt, quota_info_t sts =system ( buf );if ( sts !=0 ) {mlog (MLOG_ERROR ,_ ( -"%s failed with exit status: %d\n" ),REPQUOTA , sts); +"%s failed with exit status: %d\n" ),REPQUOTA , + sts ==-1 ?-1 :WEXITSTATUS (sts));return BOOL_FALSE ; }if ((fd =open ( quotainfo->quotapath,O_RDONLY |O_DSYNC )) <0 ) {
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Hi Christoph,
Looks reasonable.
Though, in the case of returning -1, it might be more interesting to know the value of errno ? (I presume errno would be set in that case).
--Tim
Quoted 23 lines · Christoph Hellwig
Positive returns from system need the WEXITSTATUS macro applies to get the real exit code of the executed command.
Based on analysis in oss BZ #804.
Signed-off-by Christoph Hellwig <[email protected]>Index:
xfsdump-dev/dump/content.c
===================================================================dump/content.c 2009-02-16 11:23:47.629070808 +0100 renamed from dump/content.c 2009-02-16 11:23:10.361944048 +0100 +2
-1@@ -6735,7 +6735,8 @@ save_quotas( char *mntpnt, quota_info_t sts = system( buf ); if( sts != 0 ) { mlog( MLOG_ERROR, _( - "%s failed with exit status: %d\n"), REPQUOTA, sts); + "%s failed with exit status: %d\n"), REPQUOTA, + sts == -1 ? -1 : WEXITSTATUS(sts)); return BOOL_FALSE; } if((fd = open( quotainfo->quotapath, O_RDONLY|O_DSYNC)) < 0) {
Quoted 5 lines
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 7 lines · Timothy Shimmin
Hi Christoph,
Looks reasonable.
Though, in the case of returning -1, it might be more interesting to know the value of errno ? (I presume errno would be set in that case).From looking at the manpage and the glibc implementation it seem like
system does not actually set errno.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 11 lines · Christoph Hellwig
Quoted 5 lines · Timothy Shimmin
Hi Christoph,
Looks reasonable.
Though, in the case of returning -1, it might be more interesting to know the value of errno ? (I presume errno would be set in that case).From looking at the manpage and the glibc implementation it seem like system does not actually set errno.
Fair enough.
Yeah, it didn't seem clear in the man page and
I thought it might make a call to fork, waitpid etc which might set an errno.
Cheers,
Tim.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs