diff options
| author | Julian Andres Klode <jak@debian.org> | 2024-11-28 09:49:58 +0100 |
|---|---|---|
| committer | Julian Andres Klode <julian.klode@canonical.com> | 2024-11-28 19:01:36 +0100 |
| commit | 7038347919d59b2f96a8f51f994889a5b4d66cba (patch) | |
| tree | 446d2934da7b82a943df66674dc396d6767c3746 | |
| parent | 0496bc63a3ad1dcbc41d20225c6a0d50fbcf101d (diff) | |
fileutl: Use execvp() in Popen() instead of execv()
| -rw-r--r-- | apt-pkg/contrib/fileutl.cc | 2 | ||||
| -rw-r--r-- | test/libapt/fileutl_test.cc | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index a45069ee9..67c5acee2 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -3232,7 +3232,7 @@ bool Popen(const char *Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode, } else if(Mode == FileFd::WriteOnly) dup2(fd, 0); - execv(Args[0], (char**)Args); + execvp(Args[0], (char **)Args); _exit(100); } if(Mode == FileFd::ReadOnly) diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc index b35a2d45e..2badf5465 100644 --- a/test/libapt/fileutl_test.cc +++ b/test/libapt/fileutl_test.cc @@ -288,7 +288,7 @@ TEST(FileUtlTest, Popen) OpenFds = Glob("/proc/self/fd/*"); // output something - const char* Args[10] = {"/bin/echo", "meepmeep", NULL}; + const char* Args[10] = {"echo", "meepmeep", NULL}; EXPECT_TRUE(Popen(Args, Fd, Child, FileFd::ReadOnly)); EXPECT_TRUE(Fd.Read(buf, sizeof(buf)-1, &n)); buf[n] = 0; |
