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>
#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
* 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));