Skip to content

Commit

Permalink
Remove unused parameter in pldd and simplify ELF handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Sep 6, 2011
1 parent 6d18b67 commit 6585cb6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2011-09-05 Ulrich Drepper <drepper@gmail.com>

* elf/pldd.c (get_process_info): Don't read whole ELF header, just
e_ident. Don't pass to find_mapsXX.
* elf/pldd-xx.c (find_mapsXX): Remove second parameter.

2011-07-20 Liubov Dmitrieva <liubov.dmitrieva@intel.com>

* sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
Expand Down
2 changes: 1 addition & 1 deletion elf/pldd-xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static_assert (r_map, (offsetof (struct r_debug, r_map)

static int

E(find_maps) (pid_t pid, EW(Ehdr) *ehdr, void *auxv, size_t auxv_size)
E(find_maps) (pid_t pid, void *auxv, size_t auxv_size)
{
EW(Addr) phdr = 0;
unsigned int phnum = 0;
Expand Down
16 changes: 6 additions & 10 deletions elf/pldd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 6585cb6

Please sign in to comment.