mirror of https://github.com/containers/podman.git
rootless: improve error messages
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
99258703a7
commit
9afd5e31c8
|
@ -759,6 +759,7 @@ reexec_userns_join (int pid_to_join, char *pause_pid_file_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
execvp (argv[0], argv);
|
execvp (argv[0], argv);
|
||||||
|
fprintf (stderr, "failed to execvp %s: %m\n", argv[0]);
|
||||||
|
|
||||||
_exit (EXIT_FAILURE);
|
_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -790,7 +791,10 @@ copy_file_to_fd (const char *file_to_read, int outfd)
|
||||||
|
|
||||||
fd = open (file_to_read, O_RDONLY);
|
fd = open (file_to_read, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "open `%s`: %m\n", file_to_read);
|
||||||
return fd;
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -798,7 +802,10 @@ copy_file_to_fd (const char *file_to_read, int outfd)
|
||||||
|
|
||||||
r = TEMP_FAILURE_RETRY (read (fd, buf, sizeof buf));
|
r = TEMP_FAILURE_RETRY (read (fd, buf, sizeof buf));
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "read from `%s`: %m\n", file_to_read);
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
break;
|
break;
|
||||||
|
@ -807,7 +814,10 @@ copy_file_to_fd (const char *file_to_read, int outfd)
|
||||||
{
|
{
|
||||||
w = TEMP_FAILURE_RETRY (write (outfd, &buf[t], r - t));
|
w = TEMP_FAILURE_RETRY (write (outfd, &buf[t], r - t));
|
||||||
if (w < 0)
|
if (w < 0)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "write file to output fd `%s`: %m\n", file_to_read);
|
||||||
return w;
|
return w;
|
||||||
|
}
|
||||||
t += w;
|
t += w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ func joinUserAndMountNS(pid uint, pausePid string) (bool, int, error) {
|
||||||
|
|
||||||
pidC := C.reexec_userns_join(C.int(pid), cPausePid)
|
pidC := C.reexec_userns_join(C.int(pid), cPausePid)
|
||||||
if int(pidC) < 0 {
|
if int(pidC) < 0 {
|
||||||
return false, -1, errors.Errorf("cannot re-exec process")
|
return false, -1, errors.Errorf("cannot re-exec process to join the existing user namespace")
|
||||||
}
|
}
|
||||||
|
|
||||||
ret := C.reexec_in_user_namespace_wait(pidC, 0)
|
ret := C.reexec_in_user_namespace_wait(pidC, 0)
|
||||||
|
|
Loading…
Reference in New Issue