From 739ea91d90c0d9ff9646fdaa7828f1d8fdec477b Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 14 Dec 2005 18:55:10 +0000 Subject: [PATCH] chop self_path rather than ptr --- src/sigar_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sigar_util.c b/src/sigar_util.c index e7371c1f..191b1dee 100644 --- a/src/sigar_util.c +++ b/src/sigar_util.c @@ -520,9 +520,10 @@ static int proc_module_get_self(void *data, char *name, int len) } if (strnEQ(ptr+1, "libsigar-", 9)) { - *ptr = '\0'; /* chop libsigar-powerpc-ibm-aix-4.3.x.so */ + int offset = ptr - name; sigar->self_path = sigar_strdup(name); + *(sigar->self_path + offset) = '\0'; /* chop libsigar-*.so */ if (SIGAR_LOG_IS_DEBUG(sigar)) { sigar_log_printf(sigar, SIGAR_LOG_DEBUG,