From fe9e35624ad084ac5ccbbee19c30ec0267fa2ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 14 Jun 2022 17:05:29 +0200 Subject: [PATCH] gfile: Check that using NULL symlink_value as a programmer error And also ensure that a null strings gives an error. --- gio/tests/file.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gio/tests/file.c b/gio/tests/file.c index 04248208c..28643648d 100644 --- a/gio/tests/file.c +++ b/gio/tests/file.c @@ -852,6 +852,18 @@ test_replace_symlink (void) g_test_message ("Using temporary directory %s", tmpdir_path); g_free (tmpdir_path); + source_file = g_file_get_child (tmpdir, "source"); + g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, + "*assertion*symlink_value*failed*"); + g_assert_false (g_file_make_symbolic_link (source_file, NULL, NULL, &local_error)); + g_assert_no_error (local_error); + g_test_assert_expected_messages (); + + g_assert_false (g_file_make_symbolic_link (source_file, "", NULL, &local_error)); + g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT); + g_clear_object (&source_file); + g_clear_error (&local_error); + /* Create symlink `source` which points to `target`. */ source_file = g_file_get_child (tmpdir, "source"); target_file = g_file_get_child (tmpdir, "target");