Skip to content
Snippets Groups Projects
Commit 39ff1fa4 authored by Simon McVittie's avatar Simon McVittie
Browse files

resolve-in-sysroot: Produce better diagnostics on failure to open

If we pass in SRT_RESOLVE_FLAGS_READABLE or SRT_RESOLVE_FLAGS_DIRECTORY,
and something goes wrong while we are opening the file, then the
best diagnostics libglnx can give us will be something like
"openat(/proc/self/fd/21): <strerror result>", which is not
very informative.

Adding current_path turns this into something more like
"Unable to open "foo/bar": openat(/proc/self/fd/21): <strerror result>",
which gives us more hope of figuring it out.

I originally suspected this was the error path being hit in
<https://github.com/ValveSoftware/steam-runtime/issues/366

>,
but now I think it probably isn't.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 8b3d0ad7
No related branches found
No related tags found
1 merge request!245Fix handling of Vulkan manifests in /etc (and also error handling)
...@@ -313,12 +313,20 @@ _srt_resolve_in_sysroot (int sysroot, ...@@ -313,12 +313,20 @@ _srt_resolve_in_sysroot (int sysroot,
if (flags & SRT_RESOLVE_FLAGS_DIRECTORY) if (flags & SRT_RESOLVE_FLAGS_DIRECTORY)
{ {
if (!glnx_opendirat (-1, proc_fd_name, TRUE, &fd, error)) if (!glnx_opendirat (-1, proc_fd_name, TRUE, &fd, error))
return -1; {
g_prefix_error (error, "Unable to open \"%s\" as directory: ",
current_path->str);
return -1;
}
} }
else else
{ {
if (!glnx_openat_rdonly (-1, proc_fd_name, TRUE, &fd, error)) if (!glnx_openat_rdonly (-1, proc_fd_name, TRUE, &fd, error))
return -1; {
g_prefix_error (error, "Unable to open \"%s\": ",
current_path->str);
return -1;
}
} }
if (real_path_out != NULL) if (real_path_out != NULL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment