about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-08-14 17:11:07 +0000
committerUlrich Drepper <drepper@redhat.com>2008-08-14 17:11:07 +0000
commit9cf73ab08a912e6dab7ebe7b5477342afbde825d (patch)
treee6082e1f405ae06b5c5e554358585a52d58652b1 /sysdeps/unix
parent7b3ba2c4ebbe28d60224d79c7b7aa2a0e28fca78 (diff)
downloadglibc-9cf73ab08a912e6dab7ebe7b5477342afbde825d.tar.gz
glibc-9cf73ab08a912e6dab7ebe7b5477342afbde825d.tar.xz
glibc-9cf73ab08a912e6dab7ebe7b5477342afbde825d.zip
* sysdeps/unix/sysv/linux/dl-origin.c (_dl_get_origin): Undo all
	change related to AT_EXECFN.  We cannot use that string.
	* sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Remove
	_dl_execfn member.
	* elf/dl-support.c: Remove _dl_execfn variable.
	(_dl_aux_init): Remove handling of AT_EXECFN.
	* elf/dl-sysdep.c (_dl_sysdep_start): Remove handling of AT_EXECFN.
	* elf/rtld.c (process_envvars): Remove use of __ASSUME_AT_EXECFN.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/dl-origin.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/sysdeps/unix/sysv/linux/dl-origin.c b/sysdeps/unix/sysv/linux/dl-origin.c
index 64e865b92a..a7fa53ea1d 100644
--- a/sysdeps/unix/sysv/linux/dl-origin.c
+++ b/sysdeps/unix/sysv/linux/dl-origin.c
@@ -1,5 +1,5 @@
 /* Find path of executable.
-   Copyright (C) 1998-2000, 2002, 2004, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -36,28 +36,29 @@ const char *
 _dl_get_origin (void)
 {
   char linkval[PATH_MAX];
-  const char *str;
-  char *result = (char *) -1l;
+  char *result;
   int len;
+  INTERNAL_SYSCALL_DECL (err);
 
-  str = GLRO(dl_execfn);
-  if (str == NULL || str[0] != '/')
+  len = INTERNAL_SYSCALL (readlink, err, 3, "/proc/self/exe", linkval,
+			  sizeof (linkval));
+  if (! INTERNAL_SYSCALL_ERROR_P (len, err) && len > 0 && linkval[0] != '[')
     {
-      INTERNAL_SYSCALL_DECL (err);
-
-      len = INTERNAL_SYSCALL (readlink, err, 3, "/proc/self/exe", linkval,
-			      sizeof (linkval));
-      if (! INTERNAL_SYSCALL_ERROR_P (len, err)
-	  && len > 0 && linkval[0] != '[')
-	str = linkval;
+      /* We can use this value.  */
+      assert (linkval[0] == '/');
+      while (len > 1 && linkval[len - 1] != '/')
+	--len;
+      result = (char *) malloc (len + 1);
+      if (result == NULL)
+	result = (char *) -1;
+      else if (len == 1)
+	memcpy (result, "/", 2);
       else
-	str = NULL;
+	*((char *) __mempcpy (result, linkval, len - 1)) = '\0';
     }
   else
-    len = strlen (str);
-
-  if (str == NULL)
     {
+      result = (char *) -1;
       /* We use the environment variable LD_ORIGIN_PATH.  If it is set make
 	 a copy and strip out trailing slashes.  */
       if (GLRO(dl_origin_path) != NULL)
@@ -75,20 +76,6 @@ _dl_get_origin (void)
 	    }
 	}
     }
-  else
-    {
-      /* We can use this value.  */
-      assert (str[0] == '/');
-      while (len > 1 && str[len - 1] != '/')
-	--len;
-      result = (char *) malloc (len + 1);
-      if (result == NULL)
-	result = (char *) -1;
-      else if (len == 1)
-	memcpy (result, "/", 2);
-      else
-	*((char *) __mempcpy (result, str, len - 1)) = '\0';
-    }
 
   return result;
 }