]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: try including asm/fcntl.h first for decoding flags of fdinfo
authorMasatake YAMATO <yamato@redhat.com>
Fri, 17 Jun 2022 15:28:38 +0000 (00:28 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Fri, 17 Jun 2022 15:37:37 +0000 (00:37 +0900)
Close #1720

The original code tried including asm-generic/fcntl.h before trying
including asm/fcntl.h. This caused a bug in decoding flag of fdinfo
on Linux running on armv7l.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc-utils/lsfd-decode-file-flags.c

index b9587975490abf77fd524a4717a433983637b62e..6c31f75ddc6d3d61e875864d3c712231e83b9efb 100644 (file)
  * A system on which lsfd is built may have multiple
  * fctl.h files:
  *
- * - /usr/include/asm-generic/fcntl.h (a part of Linux kernel)
  * - /usr/include/asm/fcntl.h         (a part of Linux kernel)
+ * - /usr/include/asm-generic/fcntl.h (a part of Linux kernel)
  * - /usr/include/fcntl.h             (a part of glibc)
  * - /usr/include/bits/fcntl.h        (a part of glibc)
  *
- * For decoding purpose, /usr/include/asm-generic/fcntl.h or
- * /usr/include/asm/fcntl.h is needed.
+ * For decoding purpose, /usr/include/asm/fcntl.h or
+ * /usr/include/asm-generic/fcntl.h is needed.
  *
  * /usr/include/bits/fcntl.h and /usr/include/fcntl.h are
  * not suitable for decoding. They should not be included.
  * /usr/include/fcntl.h includes /usr/include/bits/fcntl.h.
  */
 
-#ifdef HAVE_ASM_GENERIC_FCNTL_H
-#include <asm-generic/fcntl.h>
-#elif HAVE_ASM_FCNTL_H
+#if defined HAVE_ASM_FCNTL_H
 #include <asm/fcntl.h>
+#elif defined HAVE_ASM_GENERIC_FCNTL_H
+#include <asm-generic/fcntl.h>
 #else
 #error "kernel's fcntl.h is not available"
 #endif