Don't run xfsdb if we're not root.

This commit is contained in:
Andrew Gildfind
2001-02-01 05:05:22 +00:00
parent 11c790e72d
commit 86260e65c5
+4 -1
View File
@@ -73,7 +73,7 @@ use File::Basename;
chomp($os = `uname`);
#
# fsinfo: get filesystem info put it into the global namespace, assigns:
# fsinfo: get filesystem info put it into the global namespace, initialises:
# $dev, $type, $blocks, $used, $avail, $cap, $mnt, $mnt_options
# $fsblocks, $fsblocksize, $agblocks, $agcount, $imax_pct, $logblocks
# $logstart, $internal
@@ -101,6 +101,8 @@ sub fsinfo {
@mtab = split(/ +/);
$mnt_options = $mtab[3];
# if we're running as root run xfs_db on the filesystem
if ($> == 0) {
# xfs_db: read only, use the default superblock, print everything
die("Error: $progname: can't read device: \"$dev\"\n") if (! -r $dev);
$_=`xfs_db -r -c sb -c p $dev`;
@@ -123,6 +125,7 @@ Filesystem information:
agcount=$agcount; agblocks=$agblocks; logblocks=$logblocks; logstart=$logstart$internal
EOF
}
}
# returns numbers with a normal distribution