From: Darrick J. Wong Date: Wed, 23 May 2018 21:30:48 +0000 (-0500) Subject: xfs_spaceman: print a nicer message when file path isn't on xfs X-Git-Tag: v4.17.0-rc1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fb70877bdff2d1ad22759b1b4ab8ad41e454528;p=thirdparty%2Fxfsprogs-dev.git xfs_spaceman: print a nicer message when file path isn't on xfs If the file path passed in is not something on an xfs filesystem, print a nice message about that instead of yelling about ioctls. Signed-off-by: Darrick J. Wong Reviewed-by: Allison Henderson Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/spaceman/file.c b/spaceman/file.c index 4c13b4a87..23f8be1cf 100644 --- a/spaceman/file.c +++ b/spaceman/file.c @@ -69,7 +69,12 @@ openfile( } if (ioctl(fd, XFS_IOC_FSGEOMETRY, geom) < 0) { - perror("XFS_IOC_FSGEOMETRY"); + if (errno == ENOTTY) + fprintf(stderr, +_("%s: Not on a mounted XFS filesystem.\n"), + path); + else + perror("XFS_IOC_FSGEOMETRY"); close(fd); return -1; }