diff options
| author | Ulf Hermann <[email protected]> | 2017-03-27 16:33:52 +0200 |
|---|---|---|
| committer | Ulf Hermann <[email protected]> | 2017-05-04 16:12:05 +0000 |
| commit | 5e738a2deec976ffac6c313327f407d7e4760076 (patch) | |
| tree | 443eb2e8617f8198ea21e085e099d9104f71de4a /tests | |
| parent | 741248144e6361548359ad7d9e394144a0312ecf (diff) | |
Skip fchown, fchmod, fadvise, fallocate if functions are unavailable
If fchmod or fchown are unavailable, then the file permission model is
likely to be different from what we expect there. posix_fallocate is a
rather fragile affair already on linux, and not guaranteed to do
anything useful. If it's not available, the result will be the same as
when it's available and unreliable. fadvise is an optimization.
Change-Id: I28a77e976a0198cf80397b45eb1bc8cfb30664f5
Reviewed-by: Christian Kandeler <[email protected]>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ChangeLog | 5 | ||||
| -rw-r--r-- | tests/elfstrmerge.c | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index a9bc6faa..6dab8018 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2017-05-04 Ulf Hermann <[email protected]> + + * elfstrmerge.c: Don't fchmod or fchown the output file if fchmod or + fchown don't exist. + 2017-04-28 Ulf Hermann <[email protected]> * run-disasm-x86-64.sh: Disable if the native binary format is not diff --git a/tests/elfstrmerge.c b/tests/elfstrmerge.c index c2c3fb97..17f40c7d 100644 --- a/tests/elfstrmerge.c +++ b/tests/elfstrmerge.c @@ -650,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) 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) |
