summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRajesh Amaravathi <rajesh@redhat.com>2012-03-14 12:15:05 +0530
committerVijay Bellur <vijay@gluster.com>2012-03-14 03:00:18 -0700
commitdaa7cb945027e6564068310a9b857d0eb4ec1779 (patch)
treeec986bc43cd734353ba3ed83fce36363523364cd
parentb61103d7ea35a2ea190465c836fe0d22f9f6f8c1 (diff)
glusterd: file perm change for glusterd.info
this is need for the vdsm gluster plugin, changing glusterd.info file's permission to 644 from 600. Change-Id: I9de39f1b8b31a6c2f448e2ff6601eb270d042343 BUG: 802217 Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com> Reviewed-on: http://review.gluster.com/2940 Reviewed-by: Amar Tumballi <amarts@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendrabhat@gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 56b75ec90f3..56c1d98754a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -1269,8 +1269,10 @@ glusterd_store_uuid ()
char path[PATH_MAX] = {0,};
int32_t ret = -1;
glusterd_store_handle_t *handle = NULL;
+ xlator_t *this = NULL;
- priv = THIS->private;
+ this = THIS;
+ priv = this->private;
snprintf (path, PATH_MAX, "%s/%s", priv->workdir,
GLUSTERD_INFO_FILE);
@@ -1279,8 +1281,8 @@ glusterd_store_uuid ()
ret = glusterd_store_handle_new (path, &handle);
if (ret) {
- gf_log ("", GF_LOG_ERROR, "Unable to get store"
- " handle!");
+ gf_log (this->name, GF_LOG_ERROR,
+ "Unable to get store handle!");
goto out;
}
@@ -1289,7 +1291,15 @@ glusterd_store_uuid ()
handle = priv->handle;
}
- handle->fd = open (handle->path, O_RDWR | O_CREAT | O_TRUNC, 0600);
+ /* make glusterd's uuid available for users */
+ ret = chmod (handle->path, 0644);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR, "chmod error for %s: %s",
+ GLUSTERD_INFO_FILE, strerror (errno));
+ goto out;
+ }
+
+ handle->fd = open (handle->path, O_RDWR | O_CREAT | O_TRUNC, 0644);
if (handle->fd <= 0) {
ret = -1;
goto out;
@@ -1298,8 +1308,8 @@ glusterd_store_uuid ()
uuid_utoa (priv->uuid));
if (ret) {
- gf_log ("", GF_LOG_CRITICAL, "Storing uuid failed"
- "ret = %d", ret);
+ gf_log (this->name, GF_LOG_CRITICAL,
+ "Storing uuid failed ret = %d", ret);
goto out;
}
@@ -1309,7 +1319,7 @@ out:
close (handle->fd);
handle->fd = 0;
}
- gf_log ("", GF_LOG_DEBUG, "Returning %d", ret);
+ gf_log (this->name, GF_LOG_DEBUG, "Returning %d", ret);
return ret;
}