summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/Makefile.am3
-rw-r--r--libglusterfs/src/glusterfs.h2
-rw-r--r--libglusterfs/src/run.c2
-rw-r--r--libglusterfs/src/statedump.c43
4 files changed, 30 insertions, 20 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am
index 0503e97f6..d0a617e7b 100644
--- a/libglusterfs/src/Makefile.am
+++ b/libglusterfs/src/Makefile.am
@@ -1,5 +1,6 @@
libglusterfs_la_CFLAGS = -Wall $(GF_CFLAGS) \
- $(GF_DARWIN_LIBGLUSTERFS_CFLAGS)
+ $(GF_DARWIN_LIBGLUSTERFS_CFLAGS) \
+ -DDATADIR=\"$(localstatedir)\"
libglusterfs_la_CPPFLAGS = $(GF_CPPFLAGS) -D__USE_FILE_OFFSET64 \
-DXLATORDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator\" \
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index dae539841..74e6847a0 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -134,6 +134,8 @@
#define ZR_FILE_CONTENT_REQUEST(key) (!strncmp(key, ZR_FILE_CONTENT_STR, \
ZR_FILE_CONTENT_STRLEN))
+#define DEFAULT_VAR_RUN_DIRECTORY DATADIR "/run/gluster"
+
/* GlusterFS's maximum supported Auxilary GIDs */
/* TODO: Keeping it to 200, so that we can fit in 2KB buffer for auth data
* in RPC server code, if there is ever need for having more aux-gids, then
diff --git a/libglusterfs/src/run.c b/libglusterfs/src/run.c
index 94511b1c3..ebe7f3962 100644
--- a/libglusterfs/src/run.c
+++ b/libglusterfs/src/run.c
@@ -490,7 +490,7 @@ main (int argc, char **argv)
printf ("%d %d [%s]\n", ret, errno, strerror (errno));
TBANNER ("output redirection");
- fd = open ("/tmp/foof", O_WRONLY|O_CREAT|O_TRUNC, 0600);
+ fd = mkstemp ("/tmp/foof");
assert (fd != -1);
runinit (&runner);
runner_add_args (&runner, "echo", "foo", NULL);
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c
index b8ba882f3..8175faba4 100644
--- a/libglusterfs/src/statedump.c
+++ b/libglusterfs/src/statedump.c
@@ -541,7 +541,7 @@ out:
return all_disabled;
}
-/* These options are dumped by default if /tmp/glusterdump.options
+/* These options are dumped by default if glusterdump.options
file exists and it is emtpty
*/
static int
@@ -635,21 +635,22 @@ gf_proc_dump_options_init ()
char *saveptr = NULL;
char dump_option_file[PATH_MAX];
- /* glusterd will create a file /tmp/glusterdump.<pid>.options and
+ /* glusterd will create a file glusterdump.<pid>.options and
sets the statedump options for the process and the file is removed
after the statedump is taken. Direct issue of SIGUSR1 does not have
mechanism for considering the statedump options. So to have a way
of configuring the statedump of all the glusterfs processes through
- both cli command and SIGUSR1, /tmp/glusterdump.options file
- is searched and the options mentioned in it are given the higher
- priority.
+ both cli command and SIGUSR1, glusterdump.options file is searched
+ and the options mentioned in it are given the higher priority.
*/
snprintf (dump_option_file, sizeof (dump_option_file),
- "/tmp/glusterdump.options");
+ DEFAULT_VAR_RUN_DIRECTORY
+ "/glusterdump.options");
fp = fopen (dump_option_file, "r");
if (!fp) {
snprintf (dump_option_file, sizeof (dump_option_file),
- "/tmp/glusterdump.%d.options", getpid ());
+ DEFAULT_VAR_RUN_DIRECTORY
+ "/glusterdump.%d.options", getpid ());
fp = fopen (dump_option_file, "r");
@@ -696,15 +697,15 @@ gf_proc_dump_options_init ()
void
gf_proc_dump_info (int signum, glusterfs_ctx_t *ctx)
{
- int i = 0;
- int ret = -1;
- glusterfs_graph_t *trav = NULL;
- char brick_name[PATH_MAX] = {0,};
- struct timeval tv = {0,};
- char timestr[256] = {0,};
- char sign_string[512] = {0,};
- char tmp_dump_name[] = "/tmp/dumpXXXXXX";
- char path[PATH_MAX] = {0,};
+ int i = 0;
+ int ret = -1;
+ glusterfs_graph_t *trav = NULL;
+ char brick_name[PATH_MAX] = {0,};
+ char timestr[256] = {0,};
+ char sign_string[512] = {0,};
+ char tmp_dump_name[PATH_MAX] = {0,};
+ char path[PATH_MAX] = {0,};
+ struct timeval tv = {0,};
gf_proc_dump_lock ();
@@ -722,8 +723,14 @@ gf_proc_dump_info (int signum, glusterfs_ctx_t *ctx)
snprintf (path, sizeof (path), "%s/%s.%d.dump.%"PRIu64,
((dump_options.dump_path != NULL)?dump_options.dump_path:
- ((ctx->statedump_path != NULL)?ctx->statedump_path:"/tmp")),
- brick_name, getpid(), (uint64_t) time (NULL));
+ ((ctx->statedump_path != NULL)?ctx->statedump_path:
+ DEFAULT_VAR_RUN_DIRECTORY)), brick_name, getpid(),
+ (uint64_t) time (NULL));
+
+ snprintf (tmp_dump_name, PATH_MAX, "%s/dumpXXXXXX",
+ ((dump_options.dump_path != NULL)?dump_options.dump_path:
+ ((ctx->statedump_path != NULL)?ctx->statedump_path:
+ DEFAULT_VAR_RUN_DIRECTORY)));
ret = gf_proc_dump_open (tmp_dump_name);
if (ret < 0)