about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/libredirect/libredirect.c
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-09-01 11:51:02 +0000
committerAlyssa Ross <hi@alyssa.is>2023-09-01 11:51:02 +0000
commitaa4353b499e6950b7333578f936455a628145c31 (patch)
treec6332cedece2327a18d08794755b3fc0f9f1905b /nixpkgs/pkgs/build-support/libredirect/libredirect.c
parentac456d475f4e50818499b804359355c0f3b4bbf7 (diff)
parent52185f4d76c18d8348f963795dfed1de018e8dfe (diff)
downloadnixlib-aa4353b499e6950b7333578f936455a628145c31.tar
nixlib-aa4353b499e6950b7333578f936455a628145c31.tar.gz
nixlib-aa4353b499e6950b7333578f936455a628145c31.tar.bz2
nixlib-aa4353b499e6950b7333578f936455a628145c31.tar.lz
nixlib-aa4353b499e6950b7333578f936455a628145c31.tar.xz
nixlib-aa4353b499e6950b7333578f936455a628145c31.tar.zst
nixlib-aa4353b499e6950b7333578f936455a628145c31.zip
Merge https://github.com/NixOS/nixpkgs
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;