Skip to content

Commit

Permalink
Merge pull request #1548 from saschagrunert/err-tty
Browse files Browse the repository at this point in the history
Report executable not found errors after tty has been setup
  • Loading branch information
giuseppe authored Sep 4, 2024
2 parents 7d73c79 + 6bf9e7c commit dc993bd
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/libcrun/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,20 +1248,6 @@ container_init_setup (void *args, pid_t own_pid, char *notify_socket,
crun_error_release (err);
}

if (def->process && def->process->args)
{
*exec_path = find_executable (def->process->args[0], def->process->cwd);
if (UNLIKELY (*exec_path == NULL))
{
if (entrypoint_args->custom_handler == NULL && errno == ENOENT)
return crun_make_error (err, errno, "executable file `%s` not found in $PATH", def->process->args[0]);
}
/* If it fails for any other reason, ignore the failure. We'll try again the lookup
once the process switched to the use that runs in the container. This might be necessary
when opening a file that is on a network file system like NFS, where CAP_DAC_OVERRIDE
is not honored. */
}

ret = setsid ();
if (UNLIKELY (ret < 0))
return crun_make_error (err, errno, "setsid");
Expand Down Expand Up @@ -1293,6 +1279,20 @@ container_init_setup (void *args, pid_t own_pid, char *notify_socket,
}
}

if (def->process && def->process->args)
{
*exec_path = find_executable (def->process->args[0], def->process->cwd);
if (UNLIKELY (*exec_path == NULL))
{
if (entrypoint_args->custom_handler == NULL && errno == ENOENT)
return crun_make_error (err, errno, "executable file `%s` not found in $PATH", def->process->args[0]);
}
/* If it fails for any other reason, ignore the failure. We'll try again the lookup
once the process switched to the use that runs in the container. This might be necessary
when opening a file that is on a network file system like NFS, where CAP_DAC_OVERRIDE
is not honored. */
}

ret = libcrun_set_hostname (container, err);
if (UNLIKELY (ret < 0))
return ret;
Expand Down

1 comment on commit dc993bd

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.