libcap_progs: fix bash path

* in progs/capsh.c is the bash path hardcoded to '/bin/bash'.
  * this fix set's the bash path from PATH.
This commit is contained in:
j-keck 2015-02-03 10:25:16 +01:00
parent eb54864494
commit 236f7fd20d
2 changed files with 4 additions and 16 deletions

View File

@ -1,15 +0,0 @@
this patch set the bash path from '/bin/bash' to '/var/run/current-system/sw/bin/bash'
diff --git a/progs/capsh.c b/progs/capsh.c
index 52336d7..fd98a03 100644
--- a/progs/capsh.c
+++ b/progs/capsh.c
@@ -556,7 +556,7 @@ int main(int argc, char *argv[], char *envp[])
}
printf("\n");
} else if ((!strcmp("--", argv[i])) || (!strcmp("==", argv[i]))) {
- argv[i] = strdup(argv[i][0] == '-' ? "/bin/bash" : argv[0]);
+ argv[i] = strdup(argv[i][0] == '-' ? "/var/run/current-system/sw/bin/bash" : argv[0]);
argv[argc] = NULL;
execve(argv[i], argv+i, envp);
fprintf(stderr, "execve /bin/bash failed!\n");

View File

@ -9,7 +9,10 @@ stdenv.mkDerivation rec {
buildInputs = [ libcap ];
patches = [ ./progs-bash-path.patch ];
prePatch = ''
BASH=$(type -tp bash)
substituteInPlace progs/capsh.c --replace "/bin/bash" "$BASH"
'';
preConfigure = "cd progs";