Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: d97b163ff014f1096a32afc908643dfb8dd396ff
Parent: 4b4ac43455ebfe95aac903fdd4c67a8a09e4e180
Author: Abhijith Das <adas(a)redhat.com>
AuthorDate: Thu Apr 29 21:10:45 2010 -0500
Committer: Abhijith Das <adas(a)redhat.com>
CommitterDate: Thu Apr 29 21:10:45 2010 -0500
gfs_jadd: gfs_jadd does not resolve symbolic links
This patch resolves symbolic links for the device name.
Resolves: rhbz# 555363
Signed-off-by: Abhi Das <adas(a)redhat.com>
---
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 ead625b..6bdd9fc 100644
--- a/gfs/gfs_jadd/main.c
+++ b/gfs/gfs_jadd/main.c
@@ -715,33 +715,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;
}