summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-07-21 18:08:23 -0400
committerColin Walters <walters@verbum.org>2017-07-24 12:01:25 -0400
commitea6df95f22c8f2973714bdbb8b1accc4e37d4d56 (patch)
tree4a4427d064c79ace7bec6c7ca123ddd997ba7ade
parentc820571bc4389515902e268bea5489dc114c3973 (diff)
downloadlibglnx-ea6df95f22c8f2973714bdbb8b1accc4e37d4d56.tar.gz
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.
-rw-r--r--tests/test-libglnx-fdio.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/test-libglnx-fdio.c b/tests/test-libglnx-fdio.c
index d4e6272..16b6692 100644
--- a/tests/test-libglnx-fdio.c
+++ b/tests/test-libglnx-fdio.c
@@ -166,10 +166,17 @@ test_stdio_file (void)
g_autoptr(GError) local_error = NULL;
GError **error = &local_error;
g_auto(GLnxTmpfile) tmpf = { 0, };
+ g_autoptr(FILE) f = NULL;
+
if (!glnx_open_anonymous_tmpfile (O_RDWR|O_CLOEXEC, &tmpf, error))
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"))
{
(void)glnx_throw_errno_prefix (error, "fwrite");