Skip to content
Snippets Groups Projects
Commit 4040f55a authored by Colin Walters's avatar Colin Walters
Browse files

errors: Fix legacy set_prefix_error_from_errno()

We were missing the previous automatic `: ` addition; noticed in
a failing ostree test.

Fix this by just calling the new API as the non-prefix case does too.
parent 0c52d85e
No related branches found
No related tags found
No related merge requests found
...@@ -128,9 +128,7 @@ glnx_throw_errno_prefix (GError **error, const char *fmt, ...) ...@@ -128,9 +128,7 @@ glnx_throw_errno_prefix (GError **error, const char *fmt, ...)
#define glnx_set_prefix_error_from_errno(error, format, args...) \ #define glnx_set_prefix_error_from_errno(error, format, args...) \
do { \ do { \
glnx_set_error_from_errno (error); \ glnx_throw_errno_prefix (error, format, args); \
g_prefix_error (error, format, args); \
} while (0); } while (0);
G_END_DECLS G_END_DECLS
...@@ -79,9 +79,15 @@ test_error_errno (void) ...@@ -79,9 +79,15 @@ test_error_errno (void)
fd = open (noent_path, O_RDONLY); fd = open (noent_path, O_RDONLY);
if (fd < 0) if (fd < 0)
{ {
g_autofree char *expected_prefix = g_strdup_printf ("Failed to open %s", noent_path);
g_assert (!glnx_throw_errno_prefix (&error, "Failed to open %s", noent_path)); g_assert (!glnx_throw_errno_prefix (&error, "Failed to open %s", noent_path));
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
g_assert (g_str_has_prefix (error->message, glnx_strjoina ("Failed to open ", noent_path))); g_assert (g_str_has_prefix (error->message, expected_prefix));
g_clear_error (&error);
/* And test the legacy wrapper */
glnx_set_prefix_error_from_errno (&error, "Failed to open %s", noent_path);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
g_assert (g_str_has_prefix (error->message, expected_prefix));
g_clear_error (&error); g_clear_error (&error);
} }
else else
......
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