xfs
[Top] [All Lists]

Re: [PATCH] mkfs.xfs: fix fd validity check in get_topology

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH] mkfs.xfs: fix fd validity check in get_topology
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Sat, 30 Jan 2010 14:46:56 -0600
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20100130195226.GA15379@xxxxxxxxxxxxx>
References: <20100130195226.GA15379@xxxxxxxxxxxxx>
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
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@xxxxxx>

Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxxx>

> 
> 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@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs
> 

<Prev in Thread] Current Thread [Next in Thread>