diff options
author | Rajesh Amaravathi <rajesh@gluster.com> | 2011-11-02 15:26:53 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-11-11 02:09:48 -0800 |
commit | bb67817cf582678685ce1207f2a1d41fb4c3649b (patch) | |
tree | 9322a30486704f90f7142194ec95be274871ba55 /xlators | |
parent | cb9ffbe767b8e5edb30bee95e33ebe9945101250 (diff) |
debug/io-stats: prevent setfattr crash when no value given
Check for whether the dump file is given, and proceed
on success. If dump file is not given, unwind with ENOENT.
Change-Id: If524a2b20d643e0e75d81daebe59560a78000524
BUG: 3716
Reviewed-on: http://review.gluster.com/663
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 4 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 2e05be878bc..2786109b969 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -2129,6 +2129,10 @@ conditional_dump (dict_t *dict, char *key, data_t *value, void *data) if (fnmatch ("*io*stat*dump", key, 0) == 0) { + if (!strncmp (filename, "", 1)) { + gf_log (this->name, GF_LOG_ERROR, "No filename given"); + return; + } logfp = fopen (filename, "w+"); GF_ASSERT (logfp); if (!logfp) { diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 7e0022d3d58..54d09e6b260 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -2413,7 +2413,12 @@ fuse_setxattr (xlator_t *this, fuse_in_header_t *finh, void *msg) return; } - dict_value = memdup (value, fsi->size); + if (fsi->size > 0) { + dict_value = memdup (value, fsi->size); + } else { + gf_log (THIS->name, GF_LOG_ERROR, "value size zero"); + dict_value = NULL; + } dict_set (state->dict, newkey, data_from_dynptr ((void *)dict_value, fsi->size)); dict_ref (state->dict); |