mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 23:16:14 +01:00
tests: Use g_clear_fd()
This commit is contained in:
parent
e8254f14fd
commit
77c35415a3
@ -6,6 +6,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <gio/gio.h>
|
||||
#include <gio/gfiledescriptorbased.h>
|
||||
#include <glib/gstdio.h>
|
||||
#ifdef G_OS_UNIX
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
@ -2855,7 +2856,8 @@ test_load_bytes (void)
|
||||
len = strlen ("test_load_bytes");
|
||||
ret = write (fd, "test_load_bytes", len);
|
||||
g_assert_cmpint (ret, ==, len);
|
||||
close (fd);
|
||||
g_clear_fd (&fd, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
file = g_file_new_for_path (filename);
|
||||
bytes = g_file_load_bytes (file, NULL, NULL, &error);
|
||||
@ -2898,6 +2900,7 @@ test_load_bytes_async (void)
|
||||
{
|
||||
LoadBytesAsyncData data = { 0 };
|
||||
gchar filename[] = "g_file_load_bytes_XXXXXX";
|
||||
GError *error = NULL;
|
||||
int len;
|
||||
int fd;
|
||||
int ret;
|
||||
@ -2907,7 +2910,8 @@ test_load_bytes_async (void)
|
||||
len = strlen ("test_load_bytes_async");
|
||||
ret = write (fd, "test_load_bytes_async", len);
|
||||
g_assert_cmpint (ret, ==, len);
|
||||
close (fd);
|
||||
g_clear_fd (&fd, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
data.main_loop = g_main_loop_new (NULL, FALSE);
|
||||
data.file = g_file_new_for_path (filename);
|
||||
|
Loading…
Reference in New Issue
Block a user