From: Jamie Iles Date: Wed, 5 Nov 2014 12:23:59 +0000 (+0000) Subject: dwarf2ctf: don't use O_PATH in rel_abs_file_name(). X-Git-Tag: v4.1.12-92~313^2~32 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0e61e520a8507e633898fbcecaee7dd30ce6369e;p=users%2Fjedix%2Flinux-maple.git dwarf2ctf: don't use O_PATH in rel_abs_file_name(). 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 Signed-off-by: Jamie Iles Signed-off-by: Guangyu Sun Acked-by: Kris Van Hees --- diff --git a/scripts/dwarf2ctf/dwarf2ctf.c b/scripts/dwarf2ctf/dwarf2ctf.c index 598025f9610e..27d1451159a2 100644 --- a/scripts/dwarf2ctf/dwarf2ctf.c +++ b/scripts/dwarf2ctf/dwarf2ctf.c @@ -35,14 +35,6 @@ #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));