From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/elfix:master commit in: src/, /
Date: Sat, 7 Jun 2014 11:56:39 +0000 (UTC) [thread overview]
Message-ID: <1402142230.962b3194f525bbb2152d90168b8cd5d5a95a4276.blueness@gentoo> (raw)
commit: 962b3194f525bbb2152d90168b8cd5d5a95a4276
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 7 11:56:18 2014 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Jun 7 11:57:10 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=962b3194
src{fix-gnustack.c,paxctl-ng.c}: portable error reporting
---
configure.ac | 2 +-
src/fix-gnustack.c | 22 +++++++++++-----------
src/paxctl-ng.c | 4 ++--
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/configure.ac b/configure.ac
index 58a6c16..865cbaf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,7 +44,7 @@ AC_PROG_SED
# Checks for header files.
AC_CHECK_HEADERS(
- [errno.h error.h fcntl.h gelf.h libgen.h stdio.h stdlib.h string.h \
+ [errno.h err.h fcntl.h gelf.h libgen.h stdio.h stdlib.h string.h \
sys/mman.h sys/stat.h sys/types.h unistd.h],
[],
[AC_MSG_ERROR(["Missing necessary header"])]
diff --git a/src/fix-gnustack.c b/src/fix-gnustack.c
index 0d6ecc1..59e10be 100644
--- a/src/fix-gnustack.c
+++ b/src/fix-gnustack.c
@@ -19,7 +19,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <error.h>
+#include <err.h>
#include <libgen.h>
#include <gelf.h>
@@ -58,7 +58,7 @@ parse_cmd_args( int c, char *v[], int *flagv )
int i, oc;
if((c != 2)&&(c != 3))
- error(EXIT_FAILURE, 0, "Usage: %s -f ELF | -h", v[0]);
+ errx(EXIT_FAILURE, "Usage: %s -f ELF | -h", v[0]);
*flagv = 0 ;
while((oc = getopt(c, v,":fh")) != -1)
@@ -72,7 +72,7 @@ parse_cmd_args( int c, char *v[], int *flagv )
break;
case '?':
default:
- error(EXIT_FAILURE, 0, "option -%c is invalid: ignored.", optopt ) ;
+ errx(EXIT_FAILURE, "option -%c is invalid: ignored.", optopt ) ;
}
return v[optind] ;
@@ -93,31 +93,31 @@ main( int argc, char *argv[])
f_name = parse_cmd_args(argc, argv, &flagv);
if(elf_version(EV_CURRENT) == EV_NONE)
- error(EXIT_FAILURE, 0, "Library out of date.");
+ errx(EXIT_FAILURE, "Library out of date.");
if(flagv)
{
if((fd = open(f_name, O_RDWR)) < 0)
- error(EXIT_FAILURE, 0, "open() fail.");
+ errx(EXIT_FAILURE, "open() fail.");
if((elf = elf_begin(fd, ELF_C_RDWR_MMAP, NULL)) == NULL)
- error(EXIT_FAILURE, 0, "elf_begin() fail: %s", elf_errmsg(elf_errno()));
+ errx(EXIT_FAILURE, "elf_begin() fail: %s", elf_errmsg(elf_errno()));
}
else
{
if((fd = open(f_name, O_RDONLY)) < 0)
- error(EXIT_FAILURE, 0, "open() fail.");
+ errx(EXIT_FAILURE, "open() fail.");
if((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL)
- error(EXIT_FAILURE, 0, "elf_begin() fail: %s", elf_errmsg(elf_errno()));
+ errx(EXIT_FAILURE, "elf_begin() fail: %s", elf_errmsg(elf_errno()));
}
if(elf_kind(elf) != ELF_K_ELF)
- error(EXIT_FAILURE, 0, "elf_kind() fail: this is not an elf file.");
+ errx(EXIT_FAILURE, "elf_kind() fail: this is not an elf file.");
elf_getphdrnum(elf, &phnum);
for(i=0; i<phnum; ++i)
{
if(gelf_getphdr(elf, i, &phdr) != &phdr)
- error(EXIT_FAILURE, 0, "gelf_getphdr(): %s", elf_errmsg(elf_errno()));
+ errx(EXIT_FAILURE, "gelf_getphdr(): %s", elf_errmsg(elf_errno()));
if(phdr.p_type == PT_GNU_STACK)
{
@@ -132,7 +132,7 @@ main( int argc, char *argv[])
printf("W&X FOUND: X flag removed\n");
phdr.p_flags ^= PF_X;
if(!gelf_update_phdr(elf, i, &phdr))
- error(EXIT_FAILURE, 0, "gelf_update_phdr(): %s", elf_errmsg(elf_errno()));
+ errx(EXIT_FAILURE, "gelf_update_phdr(): %s", elf_errmsg(elf_errno()));
}
}
}
diff --git a/src/paxctl-ng.c b/src/paxctl-ng.c
index 8071d50..d340a43 100644
--- a/src/paxctl-ng.c
+++ b/src/paxctl-ng.c
@@ -20,7 +20,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include <error.h>
+#include <err.h>
#include <libgen.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -257,7 +257,7 @@ parse_cmd_args(int argc, char *argv[], uint16_t *pax_flags, int *verbose, int *c
break;
case '?':
default:
- error(EXIT_FAILURE, 0, "option -%c is invalid: ignored.", optopt ) ;
+ errx(EXIT_FAILURE, "option -%c is invalid: ignored.", optopt ) ;
}
}
next reply other threads:[~2014-06-07 11:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-07 11:56 Anthony G. Basile [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-11-10 23:19 [gentoo-commits] proj/elfix:master commit in: src/, / Anthony G. Basile
2012-11-10 20:02 Anthony G. Basile
2012-11-10 19:31 Anthony G. Basile
2011-11-03 11:13 Anthony G. Basile
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1402142230.962b3194f525bbb2152d90168b8cd5d5a95a4276.blueness@gentoo \
--to=blueness@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox