]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Use F_GETFD rather than F_GETFL to check validity of file descriptor
authorUlf Hermann <ulf.hermann@qt.io>
Thu, 20 Apr 2017 13:58:43 +0000 (15:58 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 2 May 2017 11:18:40 +0000 (13:18 +0200)
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>
libelf/ChangeLog
libelf/elf_begin.c

index dd82a43319fd56a7727d4f63b577730f5d794055..3772c6d175f5f67b965fb44c679b74cf1ddc8797 100644 (file)
@@ -1,3 +1,7 @@
+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
index 5e9099c272ff36d152a776fb8cdee43c28ecce92..6f85038252b3a2d54f13ddf892576b1033e96814 100644 (file)
@@ -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);