diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-03-27 16:33:52 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2017-05-04 16:12:05 +0000 |
commit | 5e738a2deec976ffac6c313327f407d7e4760076 (patch) | |
tree | 443eb2e8617f8198ea21e085e099d9104f71de4a /libasm | |
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 <christian.kandeler@qt.io>
Diffstat (limited to 'libasm')
-rw-r--r-- | libasm/ChangeLog | 4 | ||||
-rw-r--r-- | libasm/asm_end.c | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/libasm/ChangeLog b/libasm/ChangeLog index 53212139..2b499c70 100644 --- a/libasm/ChangeLog +++ b/libasm/ChangeLog @@ -1,3 +1,7 @@ +2017-05-04 Ulf Hermann <ulf.hermann@qt.io> + + * asm_end.c: Don't fchmod the new file if fchmod is unavailable. + 2017-02-28 Ulf Hermann <ulf.hermann@qt.io> * Makefile.am: Use the predefined common library names rather than diff --git a/libasm/asm_end.c b/libasm/asm_end.c index ced24f50..7fabe94d 100644 --- a/libasm/asm_end.c +++ b/libasm/asm_end.c @@ -512,12 +512,14 @@ asm_end (AsmCtx_t *ctx) if (result != 0) return result; +#if HAVE_DECL_FCHMOD /* Make the new file globally readable and user/group-writable. */ if (fchmod (ctx->fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH) != 0) { __libasm_seterrno (ASM_E_CANNOT_CHMOD); return -1; } +#endif /* Rename output file. */ if (rename (ctx->tmp_fname, ctx->fname) != 0) |