diff options
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 24 |
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; } |