]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dwarf2ctf: don't use O_PATH in rel_abs_file_name().
authorJamie Iles <jamie.iles@oracle.com>
Wed, 5 Nov 2014 12:23:59 +0000 (12:23 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 21 Jul 2015 14:29:45 +0000 (15:29 +0100)
O_PATH was introduced in v2.6.39, but fchdir() on an O_PATH opened
handle came in v3.5.  When building UEK3 on a system with a kernel <
v3.5 dwarf2ctf failed with:

  CTF Cannot return to original directory after relative realpath(): Bad
  file descriptor

Open the directory as a normal file descriptor which is a bit uglier but
allows building on systems with older kernels.

Orabug: 19957565

Cc: Nick Alcock <nick.alcock@oracle.com>
Signed-off-by: Jamie Iles <jamie.iles@oracle.com>
Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
Acked-by: Kris Van Hees <kris.van.hees@oracle.com>
scripts/dwarf2ctf/dwarf2ctf.c

index 598025f9610ef20b138239f642e98061c42faabb..27d1451159a2aa1182c44f388a4ac60272aa05ed 100644 (file)
 #define PATH_MAX 1024
 #endif
 
-/*
- * Work with older glibc: stub out O_PATH if not available.  (We can work
- * without it.)
- */
-#ifndef O_PATH
-# define O_PATH     0
-#endif
-
 #ifndef __GNUC__
 #define __attribute__((foo))
 #endif
@@ -3697,7 +3689,7 @@ static char *rel_abs_file_name(const char *file_name, const char *relative_to)
         * If we can't get this name relatively, we might as well *try* to do it
         * absolutely: but print a warning.
         */
-       if ((dir = open(".", O_RDONLY | O_DIRECTORY | O_PATH)) < 0) {
+       if ((dir = open(".", O_RDONLY | O_DIRECTORY)) < 0) {
                if (!warned) {
                        fprintf(stderr, "Cannot open current directory: %s\n",
                                strerror(errno));