[gentoo-commits] proj/elfix:master commit in: src/

2018-12-13 Thread Anthony G. Basile
commit: cede3de716079a1a00d95409caf1244f2df1c9d1
Author: Anthony G. Basile  gentoo  org>
AuthorDate: Thu Dec 13 14:47:38 2018 +
Commit: Anthony G. Basile  gentoo  org>
CommitDate: Thu Dec 13 14:48:28 2018 +
URL:https://gitweb.gentoo.org/proj/elfix.git/commit/?id=cede3de7

src/paxctl-ng.c: return ENOENT if a file is not found

This addresses https://bugs.gentoo.org/672072

Signed-off-by: Anthony G. Basile  gentoo.org>

 src/paxctl-ng.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/paxctl-ng.c b/src/paxctl-ng.c
index 25396d4..43718de 100644
--- a/src/paxctl-ng.c
+++ b/src/paxctl-ng.c
@@ -805,6 +805,13 @@ main( int argc, char *argv[])
 
if((fd = open(argv[fi], O_RDWR)) < 0)
{
+   if(errno == ENOENT) {
+   if(verbose)
+   printf("\topen() failed: file does not 
exist\n\n");
+   ret |= ENOENT;
+   continue;
+   }
+
rdwr_pt_pax = 0;
 #ifdef PTPAX
if(verbose)



[gentoo-commits] proj/elfix:master commit in: src/, scripts/, /

2018-11-28 Thread Anthony G. Basile
commit: abeac3adcbfa4b853b9a7d727f5c6b134fad6fe5
Author: Lars Wendler  gentoo  org>
AuthorDate: Tue May 15 07:33:40 2018 +
Commit: Anthony G. Basile  gentoo  org>
CommitDate: Wed Nov 28 21:33:12 2018 +
URL:https://gitweb.gentoo.org/proj/elfix.git/commit/?id=abeac3ad

attr/xattr.h is deprecated. Use sys/xattr.h instead

Signed-off-by: Anthony G. Basile  gentoo.org>

 configure.ac| 4 ++--
 scripts/paxmodule.c | 2 +-
 src/paxctl-ng.c | 5 -
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 208d566..84ef48d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,9 +114,9 @@ AS_IF(
 [test "x$enable_xtpax" != "xno"],
 [
 AC_CHECK_HEADERS(
-[attr/xattr.h],
+[sys/xattr.h],
 [],
-[AC_MSG_ERROR(["Missing necessary attr/xattr.h"])]
+[AC_MSG_ERROR(["Missing necessary sys/xattr.h"])]
 )
 AC_CHECK_LIB(
 [attr],

diff --git a/scripts/paxmodule.c b/scripts/paxmodule.c
index 1355f86..6a93420 100644
--- a/scripts/paxmodule.c
+++ b/scripts/paxmodule.c
@@ -45,7 +45,7 @@
 #endif
 
 #ifdef XTPAX
- #include 
+ #include 
  #define PAX_NAMESPACE "user.pax.flags"
 #endif
 

diff --git a/src/paxctl-ng.c b/src/paxctl-ng.c
index d340a43..25396d4 100644
--- a/src/paxctl-ng.c
+++ b/src/paxctl-ng.c
@@ -49,7 +49,10 @@
 #endif
 
 #ifdef XTPAX
- #include 
+ #include 
+ #ifndef ENOATTR
+  #define ENOATTR ENODATA
+ #endif
  #define PAX_NAMESPACE "user.pax.flags"
  #define CREATE_XT_FLAGS_SECURE 1
  #define CREATE_XT_FLAGS_DEFAULT2



[gentoo-commits] proj/elfix:master commit in: src/, /

2014-06-07 Thread Anthony G. Basile
commit: 962b3194f525bbb2152d90168b8cd5d5a95a4276
Author: Anthony G. Basile blueness AT gentoo DOT org
AuthorDate: Sat Jun  7 11:56:18 2014 +
Commit: Anthony G. Basile blueness AT gentoo DOT org
CommitDate: Sat Jun  7 11:57:10 2014 +
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; iphnum; ++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(WX 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,