summaryrefslogtreecommitdiff
path: root/libelf
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-04-20 15:58:43 +0200
committerMark Wielaard <mark@klomp.org>2017-05-02 13:18:40 +0200
commitfd9e7345b41eb2d6c11e0b8679e19df68e20171e (patch)
treeb6af3298386a63783597c260249f10531621e8ab /libelf
parentc73a00d82bbb7196c517f61cdf14c09b2b16a668 (diff)
downloadelfutils-fd9e7345b41eb2d6c11e0b8679e19df68e20171e.tar.gz
Use F_GETFD rather than F_GETFL to check validity of file descriptor
F_GETFD is both cheaper and easier to port, and otherwise has the same effect here. Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'libelf')
-rw-r--r--libelf/ChangeLog4
-rw-r--r--libelf/elf_begin.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index dd82a433..3772c6d1 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,5 +1,9 @@
2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
+ * elf_begin.c: Use F_GETFD rather than F_GETFL.
+
+2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
+
* libelf.h: Define macros for various function attributes and use
them.
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
index 5e9099c2..6f850382 100644
--- a/libelf/elf_begin.c
+++ b/libelf/elf_begin.c
@@ -1075,7 +1075,7 @@ elf_begin (int fildes, Elf_Cmd cmd, Elf *ref)
if (ref != NULL)
/* Make sure the descriptor is not suddenly going away. */
rwlock_rdlock (ref->lock);
- else if (unlikely (fcntl (fildes, F_GETFL) == -1 && errno == EBADF))
+ else if (unlikely (fcntl (fildes, F_GETFD) == -1 && errno == EBADF))
{
/* We cannot do anything productive without a file descriptor. */
__libelf_seterrno (ELF_E_INVALID_FILE);