From a263a56b60cd077e83b39d1888f4044dd3116a8d Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Tue, 2 Dec 2014 21:00:08 -0600 Subject: [PATCH] Preload handling of proc self --- c-preload/preload.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/c-preload/preload.c b/c-preload/preload.c index bc6168e29..214a6a01a 100644 --- a/c-preload/preload.c +++ b/c-preload/preload.c @@ -39,9 +39,15 @@ static int allowed_match(const char* path, const char* okpath) { char resolvedBuf[PATH_MAX]; - char* resolved = realpath(path, resolvedBuf); - if (resolved == NULL) { - return 0; + const char* resolved = path; + if (!strcmp(resolved, "/proc/self")) { + // Leave references to /proc/self alone as its real path is different + // each time. + } else { + resolved = realpath(path, resolvedBuf); + if (resolved == NULL) { + return 0; + } } while (*okpath) {