aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/virtio-9p-handle.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/9pfs/virtio-9p-handle.c')
-rw-r--r--hw/9pfs/virtio-9p-handle.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hw/9pfs/virtio-9p-handle.c b/hw/9pfs/virtio-9p-handle.c
index fe8e0ed19d..17002a3d28 100644
--- a/hw/9pfs/virtio-9p-handle.c
+++ b/hw/9pfs/virtio-9p-handle.c
@@ -582,6 +582,7 @@ static int handle_unlinkat(FsContext *ctx, V9fsPath *dir,
static int handle_ioc_getversion(FsContext *ctx, V9fsPath *path,
mode_t st_mode, uint64_t *st_gen)
{
+#ifdef FS_IOC_GETVERSION
int err;
V9fsFidOpenState fid_open;
@@ -590,7 +591,8 @@ static int handle_ioc_getversion(FsContext *ctx, V9fsPath *path,
* We can get fd for regular files and directories only
*/
if (!S_ISREG(st_mode) && !S_ISDIR(st_mode)) {
- return 0;
+ errno = ENOTTY;
+ return -1;
}
err = handle_open(ctx, path, O_RDONLY, &fid_open);
if (err < 0) {
@@ -599,6 +601,10 @@ static int handle_ioc_getversion(FsContext *ctx, V9fsPath *path,
err = ioctl(fid_open.fd, FS_IOC_GETVERSION, st_gen);
handle_close(ctx, &fid_open);
return err;
+#else
+ errno = ENOTTY;
+ return -1;
+#endif
}
static int handle_init(FsContext *ctx)