diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2019-06-16 17:27:22 +0200 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2019-06-18 22:47:11 +0200 |
commit | a3667ee6be57c9dd51a692aba6be94eef4f2d6f5 (patch) | |
tree | 0f1fae56d1790b228aef11914808649f160e8ee3 /pkgs/build-support/libredirect | |
parent | e8cdece9ce36b8d84d4f849325624f39e5f46cdf (diff) | |
download | nixpkgs-a3667ee6be57c9dd51a692aba6be94eef4f2d6f5.tar nixpkgs-a3667ee6be57c9dd51a692aba6be94eef4f2d6f5.tar.gz nixpkgs-a3667ee6be57c9dd51a692aba6be94eef4f2d6f5.tar.bz2 nixpkgs-a3667ee6be57c9dd51a692aba6be94eef4f2d6f5.tar.lz nixpkgs-a3667ee6be57c9dd51a692aba6be94eef4f2d6f5.tar.xz nixpkgs-a3667ee6be57c9dd51a692aba6be94eef4f2d6f5.tar.zst nixpkgs-a3667ee6be57c9dd51a692aba6be94eef4f2d6f5.zip |
libredirect: add posix_spawnp support
After bumping sublime3 in #61636 we realized that saving files as root doesn’t work anymore and somehow the paths weren’t patched by `libredirect`. After some debugging it came out that Sublime switched from `posix_spawn(3)` to `posix_spawnp(3)` to start new processes internally. Since `libredirect` only handled the former, `/usr/bin/pkexec` stopped being redirected. Wrapping `posix_spawnp` fixes the problem.
Diffstat (limited to 'pkgs/build-support/libredirect')
-rw-r--r-- | pkgs/build-support/libredirect/libredirect.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/build-support/libredirect/libredirect.c b/pkgs/build-support/libredirect/libredirect.c index 655399af58f..8e8da00b02a 100644 --- a/pkgs/build-support/libredirect/libredirect.c +++ b/pkgs/build-support/libredirect/libredirect.c @@ -160,6 +160,19 @@ int posix_spawn(pid_t * pid, const char * path, return posix_spawn_real(pid, rewrite(path, buf), file_actions, attrp, argv, envp); } +int posix_spawnp(pid_t * pid, const char * file, + const posix_spawn_file_actions_t * file_actions, + const posix_spawnattr_t * attrp, + char * const argv[], char * const envp[]) +{ + int (*posix_spawnp_real) (pid_t *, const char *, + const posix_spawn_file_actions_t *, + const posix_spawnattr_t *, + char * const argv[], char * const envp[]) = dlsym(RTLD_NEXT, "posix_spawnp"); + char buf[PATH_MAX]; + return posix_spawnp_real(pid, rewrite(file, buf), file_actions, attrp, argv, envp); +} + int execv(const char *path, char *const argv[]) { int (*execv_real) (const char *path, char *const argv[]) = dlsym(RTLD_NEXT, "execv"); |