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

tests: Fix a -Wmaybe-uninitialized warning

It'd be really nice if gtest had a variant which had the funcs take `GError`.
May work on that.
parent c820571b
Branches
Tags
No related merge requests found
...@@ -166,10 +166,17 @@ test_stdio_file (void) ...@@ -166,10 +166,17 @@ test_stdio_file (void)
g_autoptr(GError) local_error = NULL; g_autoptr(GError) local_error = NULL;
GError **error = &local_error; GError **error = &local_error;
g_auto(GLnxTmpfile) tmpf = { 0, }; g_auto(GLnxTmpfile) tmpf = { 0, };
g_autoptr(FILE) f = NULL;
if (!glnx_open_anonymous_tmpfile (O_RDWR|O_CLOEXEC, &tmpf, error)) if (!glnx_open_anonymous_tmpfile (O_RDWR|O_CLOEXEC, &tmpf, error))
goto out; goto out;
f = fdopen (tmpf.fd, "w");
if (!f)
{
(void)glnx_throw_errno_prefix (error, "fdopen");
goto out;
}
g_autoptr(FILE) f = fdopen (tmpf.fd, "w");
if (fwrite ("hello", 1, strlen ("hello"), f) != strlen ("hello")) if (fwrite ("hello", 1, strlen ("hello"), f) != strlen ("hello"))
{ {
(void)glnx_throw_errno_prefix (error, "fwrite"); (void)glnx_throw_errno_prefix (error, "fwrite");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment