Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=4c4... Commit: 4c4127b776eec26d09b09322cea7240a707ce152 Parent: a1222d2f5923cefbb70990ae89e1cd63aed7d2ca Author: Abhijith Das adas@redhat.com AuthorDate: Mon Feb 1 19:33:37 2010 -0600 Committer: Abhijith Das adas@redhat.com CommitterDate: Mon Feb 1 19:33:37 2010 -0600
gfs_jadd: Bug 555363 - gfs_jadd does not resolve symbolic links
This patch resolves symbolic links for the device name. gfs_grow has this patch already, somehow gfs_jadd missed it. All other gfs and gfs2 tools seem to be working ok with symlinks to the devices.
rhbz#555363 --- gfs/gfs_jadd/main.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/gfs/gfs_jadd/main.c b/gfs/gfs_jadd/main.c index f295c86..5f0affd 100644 --- a/gfs/gfs_jadd/main.c +++ b/gfs/gfs_jadd/main.c @@ -713,33 +713,42 @@ update_fs(void) */
static int -find_fs(char *name) +find_fs(const char *name) { FILE *fp = fopen("/proc/mounts", "r"); char buffer[4096]; char fstype[80]; int fsdump, fspass; + char *realname;
+ realname = realpath(name, NULL); + if (!realname) { + perror(name); + return -1; + } if (fp == NULL) { perror("open: /proc/mounts"); exit(EXIT_FAILURE); } while ((fgets(buffer, 4095, fp)) != NULL) { buffer[4095] = 0; - if (strstr(buffer, name) == 0) + if (strstr(buffer, realname) == 0) continue; if (sscanf(buffer, "%s %s %s %s %d %d", device, fspath, fstype, fsoptions, &fsdump, &fspass) != 6) continue; if (strcmp(fstype, "gfs") != 0) continue; - if ((strcmp(device, name) != 0) && (strcmp(fspath, name) != 0)) + if ((strcmp(device, realname) != 0) && + (strcmp(fspath, realname) != 0)) continue; fclose(fp); + free(realname); return 0; } fprintf(stderr, "GFS Filesystem %s not found\n", name); fclose(fp); + free(realname); return 1; }
cluster-commits@lists.stg.fedorahosted.org