diff mbox

hw/9pfs: Fix build error on platform that don't support futimens

Message ID 1317920390-21305-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com
State New
Headers show

Commit Message

Aneesh Kumar K.V Oct. 6, 2011, 4:59 p.m. UTC
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 hw/9pfs/virtio-9p-handle.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/hw/9pfs/virtio-9p-handle.c b/hw/9pfs/virtio-9p-handle.c
index 860b0e3..9860a87 100644
--- a/hw/9pfs/virtio-9p-handle.c
+++ b/hw/9pfs/virtio-9p-handle.c
@@ -386,12 +386,17 @@  static int handle_utimensat(FsContext *ctx, V9fsPath *fs_path,
     int fd, ret;
     struct handle_data *data = (struct handle_data *)ctx->private;
 
+#ifdef CONFIG_UTIMENSAT
     fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK);
     if (fd < 0) {
         return fd;
     }
     ret = futimens(fd, buf);
     close(fd);
+#else
+    ret = -1;
+    errno = ENOSYS;
+#endif
     return ret;
 }
 
@@ -591,8 +596,15 @@  static int handle_init(FsContext *ctx)
     int ret, mnt_id;
     struct statfs stbuf;
     struct file_handle fh;
-    struct handle_data *data = g_malloc(sizeof(struct handle_data));
+    struct handle_data *data;
 
+#ifndef CONFIG_UTIMENSAT
+    /*
+     * We support handle fs driver only if futimens is provided by the host
+     */
+    return -1;
+#endif
+    data = g_malloc(sizeof(struct handle_data));
     data->mountfd = open(ctx->fs_root, O_DIRECTORY);
     if (data->mountfd < 0) {
         ret = data->mountfd;