diff options
| -rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 15 | ||||
| -rw-r--r-- | libglusterfs/src/graph.y | 6 | ||||
| -rw-r--r-- | tests/bugs/949327.t | 23 | 
3 files changed, 43 insertions, 1 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index d28397a17..873844f55 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));          } diff --git a/libglusterfs/src/graph.y b/libglusterfs/src/graph.y index 92267c4c7..e2f16ff71 100644 --- a/libglusterfs/src/graph.y +++ b/libglusterfs/src/graph.y @@ -567,6 +567,12 @@ glusterfs_graph_construct (FILE *fp)          if (-1 == tmp_fd)                  goto err; +        ret = unlink (template); +        if (ret < 0) { +                gf_log ("parser", GF_LOG_WARNING, "Unable to delete file: %s", +                        template); +        } +          tmp_file = fdopen (tmp_fd, "w+b");          if (!tmp_file)                  goto err; diff --git a/tests/bugs/949327.t b/tests/bugs/949327.t new file mode 100644 index 000000000..7b0c5c51a --- /dev/null +++ b/tests/bugs/949327.t @@ -0,0 +1,23 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup; + +function tmp_file_count() +{ +echo $(ls -lh /tmp/tmp.* |  wc -l) +} + + +old_count=$(tmp_file_count); +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}0 $H0:$B0/${V0}1 +TEST $CLI volume start $V0 +new_count=$(tmp_file_count); + +TEST [ "$old_count" -eq "$new_count" ] + +cleanup  | 
