summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-09-16 07:41:42 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-16 06:38:48 -0700
commita2277a40ff8d19272abe11d9bf0257535ae0856c (patch)
tree3599d2ef06742e5e5b11f90939a4d6715b04fcca /libglusterfs
parenta64c84f2bc2ed70479df1ba281ff518461cc7cfb (diff)
logging: fix a crash in gf_log_callingfn()
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1623 (crash in logging callingfn()) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1623
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/logging.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
index 4287fe874..782c3ba8c 100644
--- a/libglusterfs/src/logging.c
+++ b/libglusterfs/src/logging.c
@@ -203,7 +203,7 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function,
char *str2 = NULL;
char *msg = NULL;
char timestr[256] = {0,};
- char callstr[1024] = {0,};
+ char callstr[4096] = {0,};
struct timeval tv = {0,};
size_t len = 0;
int ret = 0;
@@ -254,8 +254,15 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function,
if (!callingfn)
break;
- snprintf (callstr, 1024, "(-->%s (-->%s (-->%s)))", callingfn[2],
- callingfn[1], callingfn[0]);
+ if (size == 5)
+ snprintf (callstr, 4096, "(-->%s (-->%s (-->%s)))",
+ callingfn[2], callingfn[1], callingfn[0]);
+ if (size == 4)
+ snprintf (callstr, 4096, "(-->%s (-->%s))",
+ callingfn[1], callingfn[0]);
+ if (size == 3)
+ snprintf (callstr, 4096, "(-->%s)", callingfn[0]);
+
free (callingfn);
} while (0);
#endif /* HAVE_BACKTRACE */