diff --git a/pressure-vessel/adverb.c b/pressure-vessel/adverb.c index d255b587a116331c117344c9b0666427f4bab389..ac73b67d92b917b48182a9a3f7e45050f7575547 100644 --- a/pressure-vessel/adverb.c +++ b/pressure-vessel/adverb.c @@ -638,6 +638,7 @@ regenerate_ld_so_cache (const GPtrArray *ld_so_cache_paths, const char *dir, GError **error) { + g_autoptr(GError) local_error = NULL; g_autoptr(GPtrArray) argv = g_ptr_array_new (); g_autoptr(GString) conf = g_string_new (""); g_autofree gchar *child_stdout = NULL; @@ -723,15 +724,34 @@ regenerate_ld_so_cache (const GPtrArray *ld_so_cache_paths, error)) return glnx_prefix_error (error, "Cannot run /sbin/ldconfig"); + if (!g_spawn_check_exit_status (wait_status, &local_error)) + { + if (child_stderr != NULL && child_stderr[0] != '\0') + { + g_set_error (error, local_error->domain, local_error->code, + ("Unable to generate %s: %s.\n" + "Diagnostic output:\n%s"), + new_path, + local_error->message, + child_stderr); + } + else + { + g_set_error (error, local_error->domain, local_error->code, + "Unable to generate %s: %s", + new_path, + local_error->message); + } + + return FALSE; + } + if (child_stdout != NULL && child_stdout[0] != '\0') g_debug ("Output:\n%s", child_stdout); if (child_stderr != NULL && child_stderr[0] != '\0') g_debug ("Diagnostic output:\n%s", child_stderr); - if (!g_spawn_check_exit_status (wait_status, error)) - return glnx_prefix_error (error, "Unable to generate %s", new_path); - /* Atomically replace ld.so.cache with new-ld.so.cache. */ if (!glnx_renameat (AT_FDCWD, new_path, AT_FDCWD, replace_path, error)) return glnx_prefix_error (error, "Cannot move %s to %s",