[glib/2325-symlink-replace-file] WIP
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/2325-symlink-replace-file] WIP
- Date: Wed, 10 Mar 2021 17:20:45 +0000 (UTC)
commit ed8a081a375d1c121e207fc72fbcbe5767fec589
Author: Philip Withnall <pwithnall endlessos org>
Date: Wed Mar 10 17:20:38 2021 +0000
WIP
Signed-off-by: Philip Withnall <pwithnall endlessos org>
gio/glocalfileoutputstream.c | 10 ++++++++--
gio/tests/file.c | 10 ++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c
index 2b87776bc..4c512ea81 100644
--- a/gio/glocalfileoutputstream.c
+++ b/gio/glocalfileoutputstream.c
@@ -957,7 +957,13 @@ handle_overwrite_open (const char *filename,
_("Target file is a directory"));
goto err_out;
}
- else if (!is_symlink || !S_ISLNK (_g_stat_mode (&original_stat)))
+ else if (!is_symlink ||
+#ifdef S_ISLNK
+ !S_ISLNK (_g_stat_mode (&original_stat))
+#else
+ FALSE
+#endif
+ )
{
g_set_error_literal (error,
G_IO_ERROR,
@@ -1269,7 +1275,7 @@ _g_local_file_output_stream_replace (const char *filename,
set_error_from_open_errno (filename, error);
return NULL;
}
-#ifndef HAVE_O_CLOEXEC
+#if !defined(HAVE_O_CLOEXEC) && defined(F_SETFD)
else
fcntl (fd, F_SETFD, FD_CLOEXEC);
#endif
diff --git a/gio/tests/file.c b/gio/tests/file.c
index d99838d54..bccda5874 100644
--- a/gio/tests/file.c
+++ b/gio/tests/file.c
@@ -1678,6 +1678,16 @@ test_replace (gconstpointer test_data)
guint n_files;
GError *local_error = NULL;
+ /* Socket tests will only work on Linux due to the way we use mknod(). */
+#if !defined(__linux__)
+ if (tests[i].setup_source_type == FILE_TEST_SETUP_TYPE_SOCKET ||
+ tests[i].setup_backup_type == FILE_TEST_SETUP_TYPE_SOCKET)
+ {
+ g_test_message ("Skipping test %" G_GSIZE_FORMAT " due to socket use", i);
+ continue;
+ }
+#endif
+
/* Create a fresh, empty working directory. */
tmpdir_path = g_dir_make_tmp ("g_file_replace_XXXXXX", &local_error);
g_assert_no_error (local_error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]