diff options
author | Anand Avati <avati@redhat.com> | 2013-05-23 23:14:30 -0700 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-06-08 14:52:35 -0700 |
commit | 40845920cce55c4be0bb5187e820f9a92b92929c (patch) | |
tree | 2dcf7000454b56625817ea1d6bdc651313c8859d /api/src | |
parent | 481170939e445d6592621a4ea56b3fb437579226 (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/5166
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'api/src')
-rw-r--r-- | api/src/glfs.c | 13 |
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; } |