* [PATCH] xfsdump: fix system() error reporting
@ 2009-02-16 10:28 Christoph Hellwig
2009-02-17 0:08 ` Timothy Shimmin
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2009-02-16 10:28 UTC (permalink / raw)
To: xfs
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 <hch@lst.de>
Index: xfsdump-dev/dump/content.c
===================================================================
--- xfsdump-dev.orig/dump/content.c 2009-02-16 11:23:10.361944048 +0100
+++ xfsdump-dev/dump/content.c 2009-02-16 11:23:47.629070808 +0100
@@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xfsdump: fix system() error reporting
2009-02-16 10:28 [PATCH] xfsdump: fix system() error reporting Christoph Hellwig
@ 2009-02-17 0:08 ` Timothy Shimmin
2009-02-17 9:38 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Timothy Shimmin @ 2009-02-17 0:08 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: 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
On Mon, Feb 16, 2009 at 9:28 PM, Christoph Hellwig <hch@infradead.org> wrote:
> 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 <hch@lst.de>
>
> Index: xfsdump-dev/dump/content.c
> ===================================================================
> --- xfsdump-dev.orig/dump/content.c 2009-02-16 11:23:10.361944048 +0100
> +++ xfsdump-dev/dump/content.c 2009-02-16 11:23:47.629070808 +0100
> @@ -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
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xfsdump: fix system() error reporting
2009-02-17 0:08 ` Timothy Shimmin
@ 2009-02-17 9:38 ` Christoph Hellwig
2009-02-18 6:38 ` Timothy Shimmin
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2009-02-17 9:38 UTC (permalink / raw)
To: Timothy Shimmin; +Cc: Christoph Hellwig, xfs
On Tue, Feb 17, 2009 at 11:08:33AM +1100, Timothy Shimmin wrote:
> 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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xfsdump: fix system() error reporting
2009-02-17 9:38 ` Christoph Hellwig
@ 2009-02-18 6:38 ` Timothy Shimmin
0 siblings, 0 replies; 4+ messages in thread
From: Timothy Shimmin @ 2009-02-18 6:38 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs
[-- Attachment #1.1: Type: text/plain, Size: 606 bytes --]
On Tue, Feb 17, 2009 at 8:38 PM, Christoph Hellwig <hch@infradead.org>wrote:
> On Tue, Feb 17, 2009 at 11:08:33AM +1100, Timothy Shimmin wrote:
> > 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.
[-- Attachment #1.2: Type: text/html, Size: 954 bytes --]
[-- Attachment #2: Type: text/plain, Size: 121 bytes --]
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-18 7:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-16 10:28 [PATCH] xfsdump: fix system() error reporting Christoph Hellwig
2009-02-17 0:08 ` Timothy Shimmin
2009-02-17 9:38 ` Christoph Hellwig
2009-02-18 6:38 ` Timothy Shimmin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox