Signed-off-by: Greg Kurz <[email protected]>
---
hw/9pfs/9p-handle.c | 7 +------
include/sysemu/os-posix.h | 1 +
util/oslib-posix.c | 10 ++++++++++
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/hw/9pfs/9p-handle.c b/hw/9pfs/9p-handle.c
index e48e48a7145d..197c2c7efbb5 100644
--- a/hw/9pfs/9p-handle.c
+++ b/hw/9pfs/9p-handle.c
@@ -388,7 +388,6 @@ static int handle_utimensat(FsContext *ctx, V9fsPath
*fs_path,
const struct timespec *buf)
{
int ret;
-#ifdef CONFIG_UTIMENSAT
int fd;
struct handle_data *data = (struct handle_data *)ctx->private;
@@ -396,12 +395,8 @@ static int handle_utimensat(FsContext *ctx, V9fsPath
*fs_path,
if (fd < 0) {
return fd;
}
- ret = futimens(fd, buf);
+ ret = qemu_futimens(fd, buf);
close(fd);
-#else
- ret = -1;
- errno = ENOSYS;
-#endif
return ret;
}
diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h
index 9c7dfdfbec69..c2b2288bb3bf 100644
--- a/include/sysemu/os-posix.h
+++ b/include/sysemu/os-posix.h
@@ -57,6 +57,7 @@ typedef struct timeval qemu_timeval;
#endif
typedef struct timespec qemu_timespec;
int qemu_utimens(const char *path, const qemu_timespec *times);
+int qemu_futimens(int fd, const qemu_timespec *times);
bool is_daemonized(void);
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index e2e1d4d39f59..3c9de4ad1d71 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -187,6 +187,16 @@ int qemu_pipe(int pipefd[2])
return ret;
}
+int qemu_futimens(int fd, const struct timespec *times)
+{
+#ifdef CONFIG_UTIMENSAT
+ return futimens(fd, times);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
int qemu_utimens(const char *path, const struct timespec *times)
{
struct timeval tv[2], tv_now;