From dbed5c58db9db3331b2139f77e2b8a90642f0758 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Wed, 3 Jun 2020 17:51:19 +0100
Subject: [PATCH] fdio: Be const-correct for struct stat

We don't modify this struct (if non-NULL), so it can be const. In
particular, this is helpful if calling glnx_file_copy_at() from
nftw() to implement the equivalent of `cp -a --reflink=auto`.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 glnx-fdio.c | 2 +-
 glnx-fdio.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/glnx-fdio.c b/glnx-fdio.c
index 31bb15d24..6ae6ec7e3 100644
--- a/glnx-fdio.c
+++ b/glnx-fdio.c
@@ -939,7 +939,7 @@ glnx_regfile_copy_bytes (int fdf, int fdt, off_t max_bytes)
 gboolean
 glnx_file_copy_at (int                   src_dfd,
                    const char           *src_subpath,
-                   struct stat          *src_stbuf,
+                   const struct stat    *src_stbuf,
                    int                   dest_dfd,
                    const char           *dest_subpath,
                    GLnxFileCopyFlags     copyflags,
diff --git a/glnx-fdio.h b/glnx-fdio.h
index 9c57dc5ee..f95e473f8 100644
--- a/glnx-fdio.h
+++ b/glnx-fdio.h
@@ -193,7 +193,7 @@ typedef enum {
 gboolean
 glnx_file_copy_at (int                   src_dfd,
                    const char           *src_subpath,
-                   struct stat          *src_stbuf,
+                   const struct stat    *src_stbuf,
                    int                   dest_dfd,
                    const char           *dest_subpath,
                    GLnxFileCopyFlags     copyflags,
-- 
GitLab