summaryrefslogtreecommitdiffstats
path: root/api/src
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-05-23 23:14:30 -0700
committerVijay Bellur <vbellur@redhat.com>2013-05-25 11:40:07 -0700
commit2a2244972082c026061a08c76d03ec2f19b0d438 (patch)
tree72f20c6e7bf23beb7df4b4265ef507717b364c70 /api/src
parentc04a0ca7cf3a9775e21d51f9bdaa113b0f19f051 (diff)
gfapi: ignore NULL and -1 parameters in glfs_set_logging()
Permit changing either logfile or level by specifying the other as -1 or NULL respectively. Change-Id: I7df05db7b613c57e0106a5cce846ae26d2a160d4 BUG: 953694 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/5085 Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'api/src')
-rw-r--r--api/src/glfs.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index 3962a39da44..82873fe7699 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -499,13 +499,16 @@ glfs_set_volfile_server (struct glfs *fs, const char *transport,
int
glfs_set_logging (struct glfs *fs, const char *logfile, int loglevel)
{
- int ret = -1;
+ int ret = 0;
- ret = gf_log_init (fs->ctx, logfile);
- if (ret)
- return ret;
+ if (logfile) {
+ ret = gf_log_init (fs->ctx, logfile);
+ if (ret)
+ return ret;
+ }
- gf_log_set_loglevel (loglevel);
+ if (loglevel >= 0)
+ gf_log_set_loglevel (loglevel);
return ret;
}