Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/elfix:master commit in: src/
Date: Thu, 05 May 2011 22:40:22
Message-Id: ff3437254e74ee47897425b217541b8362f17a20.blueness@gentoo
1 commit: ff3437254e74ee47897425b217541b8362f17a20
2 Author: Anthony G. Basile <basile <AT> opensource <DOT> dyc <DOT> edu>
3 AuthorDate: Thu May 5 22:38:50 2011 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Thu May 5 22:38:50 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=ff343725
7
8 src/fix-gnustack.c: improved error messages
9
10 ---
11 src/fix-gnustack.c | 10 +++++-----
12 1 files changed, 5 insertions(+), 5 deletions(-)
13
14 diff --git a/src/fix-gnustack.c b/src/fix-gnustack.c
15 index 8315873..75d72ea 100644
16 --- a/src/fix-gnustack.c
17 +++ b/src/fix-gnustack.c
18 @@ -75,14 +75,14 @@ main( int argc, char *argv[])
19 if((fd = open(f_name, O_RDWR)) < 0)
20 error(EXIT_FAILURE, 0, "open() fail.");
21 if((elf = elf_begin(fd, ELF_C_RDWR_MMAP, NULL)) == NULL)
22 - error(EXIT_FAILURE, 0, "elf_begin() fail: %s", elf_errmsg(-1));
23 + error(EXIT_FAILURE, 0, "elf_begin() fail: %s", elf_errmsg(elf_errno()));
24 }
25 else
26 {
27 if((fd = open(f_name, O_RDONLY)) < 0)
28 error(EXIT_FAILURE, 0, "open() fail.");
29 if((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL)
30 - error(EXIT_FAILURE, 0, "elf_begin() fail: %s", elf_errmsg(-1));
31 + error(EXIT_FAILURE, 0, "elf_begin() fail: %s", elf_errmsg(elf_errno()));
32 }
33
34 if(elf_kind(elf) != ELF_K_ELF)
35 @@ -92,7 +92,7 @@ main( int argc, char *argv[])
36 for(i=0; i<phnum; ++i)
37 {
38 if(gelf_getphdr(elf, i, &phdr) != &phdr)
39 - error(EXIT_FAILURE, 0, "gelf_getphdr(): %s", elf_errmsg(-1));
40 + error(EXIT_FAILURE, 0, "gelf_getphdr(): %s", elf_errmsg(elf_errno()));
41
42 if(phdr.p_type == PT_GNU_STACK)
43 {
44 @@ -104,10 +104,10 @@ main( int argc, char *argv[])
45
46 if(flagv && (phdr.p_flags & PF_W) && (phdr.p_flags & PF_X))
47 {
48 - printf("W&X FOUND: flipping X flag ...\n");
49 + printf("W&X FOUND: X flag removed\n");
50 phdr.p_flags ^= PF_X;
51 if(!gelf_update_phdr(elf, i, &phdr))
52 - error(EXIT_FAILURE, 0, "gelf_update_phdr(): %s", elf_errmsg(-1));
53 + error(EXIT_FAILURE, 0, "gelf_update_phdr(): %s", elf_errmsg(elf_errno()));
54 }
55 }
56 }