about summary refs log tree commit diff
path: root/elf/pldd.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-09-05 21:49:14 -0400
committerUlrich Drepper <drepper@gmail.com>2011-09-05 21:49:14 -0400
commit6585cb60ee7aafc3301c402dda12d6771dfb7fa3 (patch)
tree74a43e5bebc5f9d23c48e5fbc055fc05261e3a8f /elf/pldd.c
parent6d18b67f4df2db7ceb315a264ad43a27d86ba697 (diff)
downloadglibc-6585cb60ee7aafc3301c402dda12d6771dfb7fa3.tar.gz
glibc-6585cb60ee7aafc3301c402dda12d6771dfb7fa3.tar.xz
glibc-6585cb60ee7aafc3301c402dda12d6771dfb7fa3.zip
Remove unused parameter in pldd and simplify ELF handling
Diffstat (limited to 'elf/pldd.c')
-rw-r--r--elf/pldd.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/elf/pldd.c b/elf/pldd.c
index 29879f7e85..e97d96ae02 100644
--- a/elf/pldd.c
+++ b/elf/pldd.c
@@ -247,17 +247,13 @@ get_process_info (int dfd, long int pid)
       return EXIT_FAILURE;
     }
 
-  union
-  {
-    Elf32_Ehdr ehdr32;
-    Elf64_Ehdr ehdr64;
-  } uehdr;
-  if (read (fd, &uehdr, sizeof (uehdr)) != sizeof (uehdr))
+  char e_ident[EI_NIDENT];
+  if (read (fd, e_ident, EI_NIDENT) != EI_NIDENT)
     goto no_info;
 
   close (fd);
 
-  if (memcmp (uehdr.ehdr32.e_ident, ELFMAG, SELFMAG) != 0)
+  if (memcmp (e_ident, ELFMAG, SELFMAG) != 0)
     {
       error (0, 0, gettext ("process %lu is no ELF program"), pid);
       return EXIT_FAILURE;
@@ -287,10 +283,10 @@ get_process_info (int dfd, long int pid)
   close (fd);
 
   int retval;
-  if (uehdr.ehdr32.e_ident[EI_CLASS] == ELFCLASS32)
-    retval = find_maps32 (pid, &uehdr.ehdr32, auxv, auxv_size);
+  if (e_ident[EI_CLASS] == ELFCLASS32)
+    retval = find_maps32 (pid, auxv, auxv_size);
   else
-    retval = find_maps64 (pid, &uehdr.ehdr64, auxv, auxv_size);
+    retval = find_maps64 (pid, auxv, auxv_size);
 
   free (auxv);
   close (memfd);