aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pseudo_util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/pseudo_util.c b/pseudo_util.c
index b6980c2..b9de81e 100644
--- a/pseudo_util.c
+++ b/pseudo_util.c
@@ -29,6 +29,11 @@
#include "pseudo_ipc.h"
#include "pseudo_db.h"
+/* O_PATH is defined in glibc 2.16 and later only */
+#ifndef O_PATH
+#define O_PATH 010000000
+#endif
+
struct pseudo_variables {
char *key;
size_t key_len;
@@ -678,6 +683,18 @@ pseudo_append_element(char *newpath, char *root, size_t allocated, char **pcurre
*/
if (!leave_this && is_dir) {
int is_link = S_ISLNK(buf->st_mode);
+
+ /* do not expand symlinks in the proc filesystem, since they may not be real
+ * check if newpath starts with "/proc/"
+ * strlen of "/proc/" = 6
+ */
+ if (is_link && (strncmp("/proc/", newpath, 6) == 0)) {
+ pseudo_debug(PDBGF_PATH | PDBGF_VERBOSE,
+ "pae: '%s' is procfs symlink, not expanding\n",
+ newpath);
+ is_link = 0;
+ }
+
if (link_recursion >= PSEUDO_MAX_LINK_RECURSION && is_link) {
pseudo_diag("link recursion too deep, not expanding path '%s'.\n", newpath);
is_link = 0;