public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mkfs.xfs: fix fd validity check in get_topology
@ 2010-01-30 19:52 Christoph Hellwig
  2010-01-30 20:46 ` Eric Sandeen
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2010-01-30 19:52 UTC (permalink / raw)
  To: xfs

Only negatie return values from open mean we failed to open the device.
Without this check we do not print the usage message when no device is
specified.  This leads to a weird failure in xfstests 122.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: xfsprogs-dev/mkfs/xfs_mkfs.c
===================================================================
--- xfsprogs-dev.orig/mkfs/xfs_mkfs.c	2010-01-30 20:44:03.505255109 +0100
+++ xfsprogs-dev/mkfs/xfs_mkfs.c	2010-01-30 20:44:20.579255807 +0100
@@ -455,7 +455,7 @@ static void get_topology(libxfs_init_t *
 				&ft->dsunit, &ft->dswidth, &ft->sectoralign);
 		fd = open(dfile, O_RDONLY);
 		/* If this fails we just fall back to BBSIZE */
-		if (fd) {
+		if (fd >= 0) {
 			platform_findsizes(dfile, fd, &dummy, &bsz);
 			close(fd);
 		}

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mkfs.xfs: fix fd validity check in get_topology
  2010-01-30 19:52 [PATCH] mkfs.xfs: fix fd validity check in get_topology Christoph Hellwig
@ 2010-01-30 20:46 ` Eric Sandeen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Sandeen @ 2010-01-30 20:46 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

Christoph Hellwig wrote:
> Only negatie return values from open mean we failed to open the device.
> Without this check we do not print the usage message when no device is
> specified.  This leads to a weird failure in xfstests 122.

and unhelpful help for any user... argh :(

> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Eric Sandeen <sandeen@sandeen.ent>

> 
> Index: xfsprogs-dev/mkfs/xfs_mkfs.c
> ===================================================================
> --- xfsprogs-dev.orig/mkfs/xfs_mkfs.c	2010-01-30 20:44:03.505255109 +0100
> +++ xfsprogs-dev/mkfs/xfs_mkfs.c	2010-01-30 20:44:20.579255807 +0100
> @@ -455,7 +455,7 @@ static void get_topology(libxfs_init_t *
>  				&ft->dsunit, &ft->dswidth, &ft->sectoralign);
>  		fd = open(dfile, O_RDONLY);
>  		/* If this fails we just fall back to BBSIZE */
> -		if (fd) {
> +		if (fd >= 0) {
>  			platform_findsizes(dfile, fd, &dummy, &bsz);
>  			close(fd);
>  		}
> 
> _______________________________________________
> 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] 2+ messages in thread

end of thread, other threads:[~2010-01-30 20:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-30 19:52 [PATCH] mkfs.xfs: fix fd validity check in get_topology Christoph Hellwig
2010-01-30 20:46 ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox