Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 35adedb8830cf948b43b86231991124b > files > 116

gfs2-utils-0.1.62-39.el5.src.rpm

commit 6f9e71a735281ae034cb9741a499b01127f9712e
Author: Bob Peterson <rpeterso@redhat.com>
Date:   Fri May 28 08:28:46 2010 -0500

    Fix device name and mount point in utils
    
    This patch fixes a regression introduced by commit 04f7da3 whereby
    the gfs2-utils identified whether a gfs2 file system was mounted.
    The method works fine when specifying the mount point for tools like
    gfs2_grow.  However, it doesn't work when the device is specified.
    The solution is to copy the discovered device name and mount point
    into the proper libgfs2 variables used by the utils.
    
    rhbz#597002

diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index e277e27..81c7e2e 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -121,9 +121,7 @@ int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount)
 	}
 	if (stat(sdp->path_name, &st_buf) == 0) {
 		if (S_ISBLK(st_buf.st_mode)) {
-#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
 			file_rdev = st_buf.st_rdev;
-#endif  /* __GNU__ */
 		} else {
 			file_dev = st_buf.st_dev;
 			file_ino = st_buf.st_ino;
@@ -139,16 +137,21 @@ int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount)
 			strcpy(sdp->device_name, mnt->mnt_fsname); /* fix it */
 			break;
 		}
-		if (stat(mnt->mnt_fsname, &st_buf) == 0) {
-			if (S_ISBLK(st_buf.st_mode)) {
-#ifndef __GNU__
-				if (file_rdev && (file_rdev == st_buf.st_rdev))
-					break;
-#endif  /* __GNU__ */
-			} else {
-				if (file_dev && ((file_dev == st_buf.st_dev) &&
-						 (file_ino == st_buf.st_ino)))
-					break;
+		if (stat(mnt->mnt_fsname, &st_buf) != 0)
+			continue;
+
+		if (S_ISBLK(st_buf.st_mode)) {
+			if (file_rdev && (file_rdev == st_buf.st_rdev)) {
+				strcpy(sdp->device_name, mnt->mnt_fsname);
+				strcpy(sdp->path_name, mnt->mnt_dir);
+				break;
+			}
+		} else {
+			if (file_dev && ((file_dev == st_buf.st_dev) &&
+					 (file_ino == st_buf.st_ino))) {
+				strcpy(sdp->device_name, mnt->mnt_fsname);
+				strcpy(sdp->path_name, mnt->mnt_dir);
+				break;
 			}
 		}
 	}