diff options
Diffstat (limited to 'tests/elfstrmerge.c')
| -rw-r--r-- | tests/elfstrmerge.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/elfstrmerge.c b/tests/elfstrmerge.c index 8d5b53cb..5405ed81 100644 --- a/tests/elfstrmerge.c +++ b/tests/elfstrmerge.c @@ -29,7 +29,6 @@ #include <inttypes.h> #include <unistd.h> -#include <system.h> #include <gelf.h> #include ELFUTILS_HEADER(dwelf) #include "elf-knowledge.h" @@ -165,7 +164,7 @@ main (int argc, char **argv) fname = argv[1]; else fname = argv[3]; - fd = open (fname, O_RDONLY); + fd = open (fname, O_RDONLY | O_BINARY); if (fd < 0) fail_errno ("couldn't open", fname); @@ -368,7 +367,7 @@ main (int argc, char **argv) else { fnew = argv[2]; - fdnew = open (fnew, O_WRONLY | O_CREAT, st.st_mode & ALLPERMS); + fdnew = open (fnew, O_WRONLY | O_CREAT | O_BINARY, st.st_mode & 07777); } if (fdnew < 0) @@ -651,11 +650,15 @@ main (int argc, char **argv) elf_end (elfnew); elfnew = NULL; +#if HAVE_DECL_FCHMOD /* Try to match mode and owner.group of the original file. */ - if (fchmod (fdnew, st.st_mode & ALLPERMS) != 0) + if (fchmod (fdnew, st.st_mode & 07777) != 0) error (0, errno, "Couldn't fchmod %s", fnew); +#endif +#if HAVE_DECL_FCHOWN if (fchown (fdnew, st.st_uid, st.st_gid) != 0) error (0, errno, "Couldn't fchown %s", fnew); +#endif /* Finally replace the old file with the new merged strings file. */ if (replace) |
