aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/dl-origin.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/dl-origin.h')
-rw-r--r--sysdeps/unix/sysv/linux/dl-origin.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/sysdeps/unix/sysv/linux/dl-origin.h b/sysdeps/unix/sysv/linux/dl-origin.h
index eef067814a..7f7d86c404 100644
--- a/sysdeps/unix/sysv/linux/dl-origin.h
+++ b/sysdeps/unix/sysv/linux/dl-origin.h
@@ -30,15 +30,15 @@ get_origin (void)
char *result;
if (readlink ("/proc/self/exe", linkval, PATH_MAX) != -1
- && result[0] != '[')
+ && linkval[0] != '[')
{
/* We can use this value. */
char *last_slash = strrchr (linkval, '/');
- result = (char *) malloc (linkval - last_slash + 1);
+ result = (char *) malloc (last_slash - linkval + 1);
if (result == NULL)
result = (char *) -1;
else
- *((char *) __mempcpy (result, linkval, linkval - last_slash)) = '\0';
+ *((char *) __mempcpy (result, linkval, last_slash - linkval)) = '\0';
}
else
{