/* Provide relocatable programs.
- Copyright (C) 2003-2010 Free Software Foundation, Inc.
+ Copyright (C) 2003-2011 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software: you can redistribute it and/or modify
# include "xalloc.h"
#endif
+#ifndef O_EXEC
+# define O_EXEC O_RDONLY /* This is often close enough in older systems. */
+#endif
+
/* Declare canonicalize_file_name.
The <stdlib.h> included above may be the system's one, not the gnulib
one. */
#undef open
#undef close
+/* Use the system functions, not the gnulib overrides in this file. */
+#undef malloc
+#undef sprintf
+
#undef set_program_name
if (link != NULL && link[0] != '[')
return link;
if (executable_fd < 0)
- executable_fd = open ("/proc/self/exe", O_RDONLY, 0);
+ executable_fd = open ("/proc/self/exe", O_EXEC, 0);
{
char buf[6+10+5];
if (link != NULL && link[0] != '[')
return link;
if (executable_fd < 0)
- executable_fd = open (buf, O_RDONLY, 0);
+ executable_fd = open (buf, O_EXEC, 0);
}
}
#endif