aboutsummaryrefslogtreecommitdiff
path: root/pk/syscall.c
diff options
context:
space:
mode:
Diffstat (limited to 'pk/syscall.c')
-rw-r--r--pk/syscall.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/pk/syscall.c b/pk/syscall.c
index 2d96282..d4785b6 100644
--- a/pk/syscall.c
+++ b/pk/syscall.c
@@ -102,7 +102,9 @@ static int at_kfd(int dirfd)
file_t* dir = file_get(dirfd);
if (dir == NULL)
return -1;
- return dir->kfd;
+ if (dir->typ != FILE_HOST)
+ return -1;
+ return ((host_file_t*) dir)->kfd;
}
int sys_openat(int dirfd, const char* name, int flags, int mode)
@@ -156,9 +158,10 @@ int sys_fcntl(int fd, int cmd, int arg)
int r = -EBADF;
file_t* f = file_get(fd);
- if (f)
+ if (f && f->typ == FILE_HOST)
{
- r = frontend_syscall(SYS_fcntl, f->kfd, cmd, arg, 0, 0, 0, 0);
+ host_file_t *hf = (host_file_t *) f;
+ r = frontend_syscall(SYS_fcntl, hf->kfd, cmd, arg, 0, 0, 0, 0);
file_decref(f);
}