summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorShyamsundarR <srangana@redhat.com>2018-07-26 13:32:52 -0400
committerAmar Tumballi <amarts@redhat.com>2018-07-27 09:06:09 +0000
commit405c6e8a8a64f29b37c154091e1677ef67440e73 (patch)
treef1152850ed93c05d8b323e1e6f9167678234add9 /libglusterfs
parent46a2cbfb73f7fade3426fd07c5830e9fac82883c (diff)
stack: Reduce stack usage for local variables to store tmpfile names
This patch moves stack based PATH_MAX allocations for tmpfile names, to heap allocated names instead. Reducing the impact on stack space used and accruing benefits thereof. Change-Id: I646d9cb091018de6768b3523902788fa2ba14d96 Updates: bz#1193929 Signed-off-by: ShyamsundarR <srangana@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/graph.y3
1 files changed, 1 insertions, 2 deletions
diff --git a/libglusterfs/src/graph.y b/libglusterfs/src/graph.y
index bf7886b5a8e..3c3f7b5bb82 100644
--- a/libglusterfs/src/graph.y
+++ b/libglusterfs/src/graph.y
@@ -555,14 +555,13 @@ glusterfs_graph_construct (FILE *fp)
int tmp_fd = -1;
glusterfs_graph_t *graph = NULL;
FILE *tmp_file = NULL;
- char template[PATH_MAX] = {0};
+ char template[] = "/tmp/tmp.XXXXXX";
static pthread_mutex_t graph_mutex = PTHREAD_MUTEX_INITIALIZER;
graph = glusterfs_graph_new ();
if (!graph)
goto err;
- strcpy (template, "/tmp/tmp.XXXXXX");
/* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */
tmp_fd = mkstemp (template);
if (-1 == tmp_fd)