chop self_path rather than ptr

This commit is contained in:
Doug MacEachern 2005-12-14 18:55:10 +00:00
parent 6f67476977
commit 739ea91d90
1 changed files with 2 additions and 1 deletions

View File

@ -520,9 +520,10 @@ static int proc_module_get_self(void *data, char *name, int len)
} }
if (strnEQ(ptr+1, "libsigar-", 9)) { 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 = sigar_strdup(name);
*(sigar->self_path + offset) = '\0'; /* chop libsigar-*.so */
if (SIGAR_LOG_IS_DEBUG(sigar)) { if (SIGAR_LOG_IS_DEBUG(sigar)) {
sigar_log_printf(sigar, SIGAR_LOG_DEBUG, sigar_log_printf(sigar, SIGAR_LOG_DEBUG,