about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/libredirect/libredirect.c
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/build-support/libredirect/libredirect.c')
-rw-r--r--nixpkgs/pkgs/build-support/libredirect/libredirect.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixpkgs/pkgs/build-support/libredirect/libredirect.c b/nixpkgs/pkgs/build-support/libredirect/libredirect.c
index 19211a813eb8..fdbdcb6ebb86 100644
--- a/nixpkgs/pkgs/build-support/libredirect/libredirect.c
+++ b/nixpkgs/pkgs/build-support/libredirect/libredirect.c
@@ -70,9 +70,12 @@ static void init()
 
 }
 
-static const char * rewrite(const char * path, char * buf)
+static const char * rewrite(const char * volatile path, char * buf)
 {
+    // Marking the path volatile is needed so the the following check isn't
+    // optimized away by the compiler.
     if (path == NULL) return path;
+
     for (int n = 0; n < nrRedirects; ++n) {
         int len = strlen(from[n]);
         if (strncmp(path, from[n], len) != 0) continue;