mkfs.gfs2: Follow symlinks before checking device contents
When using symlinks with mkfs.gfs2 it reports what the symlink points
to instead of the contents of the device, like so:
# ./mkfs.gfs2 -p lock_nolock /dev/vg/test
This will destroy any data on /dev/vg/test.
It appears to contain: symbolic link to `../dm-3'
This patch resolves symlinks before checking the device contents to make
the output more informative:
# ./mkfs.gfs2 -p lock_nolock /dev/vg/test
This will destroy any data on /dev/vg/test.
It appears to contain: GFS2 Filesystem (blocksize 4096, lockproto lock_nolock)
+ absname = canonicalize_file_name(sdp->device_name);
+ if (absname == NULL) {
+ perror(_("Could not find the absolute path of the device"));
+ exit(EXIT_FAILURE);
+ }
if (!sdp->override) {
printf( _("This will destroy any data on %s.
"), sdp->device_name);
- check_dev_content(sdp->device_name);
+ check_dev_content(absname);
are_you_sure();
}
+ free(absname);
if (sdp->bsize == -1) {
if (S_ISREG(sdp->dinfo.stat.st_mode))
--
1.7.7.6