]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_spaceman: print a nicer message when file path isn't on xfs
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 23 May 2018 21:30:48 +0000 (16:30 -0500)
committerEric Sandeen <sandeen@redhat.com>
Wed, 23 May 2018 21:30:48 +0000 (16:30 -0500)
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 <darrick.wong@oracle.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
spaceman/file.c

index 4c13b4a87033e7cf6e93198579c381947800fc97..23f8be1cfaf353d8cbbce2cf6216d1965d46c91c 100644 (file)
@@ -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;
        }