summaryrefslogtreecommitdiffstats
path: root/glusterfsd
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2013-04-08 00:46:27 +0530
committerAnand Avati <avati@redhat.com>2013-04-08 14:21:39 -0700
commite0fac0b68ff23a87da3eda4ced7a60b3e2fcf77a (patch)
tree6ccedd01ddb2262487c998027824af430ad2df96 /glusterfsd
parent6f6744730e34fa8a161b5f7f2a8ad3f8a7fc30fa (diff)
glusterfsd: Cleanup temporary files from /tmp
For each gluster{d,fs,fsd} start, one or more temporary file(s) created in /tmp were not being unlinked. This patch cleans that up. Modified a typo in an unrelated log message as well. Change-Id: I3dec2a2ca40c7d6828eb238ec9cd08b6072cf0dd BUG: 949327 Signed-off-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/4786 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index d28397a1730..873844f554b 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -1417,6 +1417,19 @@ glusterfs_volfile_reconfigure (FILE *newvolfile_fp)
strcpy (template, "/tmp/tmp.XXXXXX");
oldvolfile_fd = mkstemp (template);
+ if (oldvolfile_fd == -1) {
+ gf_log ("glusterfsd-mgmt", GF_LOG_ERROR, "Unable to create "
+ "temporary file: %s (%s)", template,
+ strerror (errno));
+ goto out;
+ }
+
+ ret = unlink (template);
+ if (ret < 0) {
+ gf_log ("glusterfsd-mgmt", GF_LOG_WARNING, "Unable to delete "
+ "file: %s", template);
+ }
+
oldvolfile_fp = fdopen (oldvolfile_fd, "w+b");
if (!oldvolfile_fp) {
gf_log ("glusterfsd-mgmt", GF_LOG_CRITICAL, "Failed to create "
@@ -1947,7 +1960,7 @@ glusterfs_listener_stop (glusterfs_ctx_t *ctx)
if (ret) {
this = THIS;
- gf_log (this->name, GF_LOG_ERROR, "Failed to unlink linstener "
+ gf_log (this->name, GF_LOG_ERROR, "Failed to unlink listener "
"socket %s, error: %s", cmd_args->sock_file,
strerror (errno));
}