mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-10-11 00:17:41 +00:00
Merge pull request #29657 from sundeep8967/fix/pause-process-environ
rootless: clear environment before spawning pause process
This commit is contained in:
commit
95fc00bca3
1 changed files with 3 additions and 1 deletions
|
|
@ -656,7 +656,7 @@ is_pause_process (long pid)
|
|||
if (asprintf (&environ_path, "/proc/%ld/environ", pid) < 0)
|
||||
return 0;
|
||||
|
||||
buf = malloc (buf_size);
|
||||
buf = malloc (buf_size + 1);
|
||||
if (buf == NULL)
|
||||
return 0;
|
||||
|
||||
|
|
@ -668,6 +668,7 @@ is_pause_process (long pid)
|
|||
n = TEMP_FAILURE_RETRY (read (fd, buf, buf_size));
|
||||
if (n <= 0)
|
||||
return 0;
|
||||
buf[n] = '\0';
|
||||
|
||||
/* environ entries are separated by '\0'. Search for "_PODMAN_PAUSE=1". */
|
||||
for (char *p = buf; p < buf + n; )
|
||||
|
|
@ -1099,6 +1100,7 @@ create_pause_process (const char *state_dir, char **argv)
|
|||
for (fd = 3; fd < open_files_max_fd + 16; fd++)
|
||||
close (fd);
|
||||
|
||||
clearenv ();
|
||||
setenv ("_PODMAN_PAUSE", "1", 1);
|
||||
execlp (argv[0], argv[0], NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue