summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--glnx-backports.h20
-rw-r--r--glnx-fdio.c15
-rw-r--r--meson.build2
3 files changed, 34 insertions, 3 deletions
diff --git a/glnx-backports.h b/glnx-backports.h
index bdc4bbe..d109833 100644
--- a/glnx-backports.h
+++ b/glnx-backports.h
@@ -68,6 +68,26 @@ gboolean glnx_set_object (GObject **object_ptr,
#endif /* !GLIB_CHECK_VERSION(2, 44, 0) */
+#if !GLIB_CHECK_VERSION(2, 38, 0)
+#define G_SPAWN_DEFAULT ((GSpawnFlags) 0)
+#endif
+
+#if !GLIB_CHECK_VERSION(2, 42, 0)
+#define G_OPTION_FLAG_NONE ((GOptionFlags) 0)
+#endif
+
+#ifndef G_DBUS_METHOD_INVOCATION_HANDLED /* added in 2.68 */
+#define G_DBUS_METHOD_INVOCATION_HANDLED TRUE
+#endif
+
+#ifndef G_DBUS_METHOD_INVOCATION_UNHANDLED /* added in 2.68 */
+#define G_DBUS_METHOD_INVOCATION_UNHANDLED FALSE
+#endif
+
+#if !GLIB_CHECK_VERSION(2, 70, 0)
+#define G_OPTION_ENTRY_NULL { NULL, 0, 0, 0, NULL, NULL, NULL }
+#endif
+
#ifndef g_assert_nonnull
#define g_assert_nonnull(x) g_assert (x != NULL)
#endif
diff --git a/glnx-fdio.c b/glnx-fdio.c
index ee69aa1..b1af679 100644
--- a/glnx-fdio.c
+++ b/glnx-fdio.c
@@ -794,10 +794,21 @@ glnx_regfile_copy_bytes (int fdf, int fdt, off_t max_bytes)
/* If we've requested to copy the whole range, try a full-file clone first.
*/
- if (max_bytes == (off_t) -1)
+ if (max_bytes == (off_t) -1 &&
+ lseek (fdf, 0, SEEK_CUR) == 0 &&
+ lseek (fdt, 0, SEEK_CUR) == 0)
{
if (ioctl (fdt, FICLONE, fdf) == 0)
- return 0;
+ {
+ /* All the other methods advance the fds. Do it here too for consistency. */
+ if (lseek (fdf, 0, SEEK_END) < 0)
+ return -1;
+ if (lseek (fdt, 0, SEEK_END) < 0)
+ return -1;
+
+ return 0;
+ }
+
/* Fall through */
struct stat stbuf;
diff --git a/meson.build b/meson.build
index 4787c85..38ec2ea 100644
--- a/meson.build
+++ b/meson.build
@@ -7,7 +7,7 @@ project(
'c',
default_options : [
'c_std=gnu99',
- 'warning_level=3',
+ 'warning_level=2',
],
)