From daa7cb945027e6564068310a9b857d0eb4ec1779 Mon Sep 17 00:00:00 2001 From: Rajesh Amaravathi Date: Wed, 14 Mar 2012 12:15:05 +0530 Subject: 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 Reviewed-on: http://review.gluster.com/2940 Reviewed-by: Amar Tumballi Tested-by: Gluster Build System Reviewed-by: Raghavendra Bhat Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-store.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index 56b75ec90..56c1d9875 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; } -- cgit