Skip to content

Commit bc68858

Browse files
committed
Reenable F_SETFL which is necessary for enabling O_NONBLOCK
This should be safe as file access mode and file creation flags are ignored according to the man page.
1 parent 8004faa commit bc68858

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/tinykvm/linux/system_calls.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,8 +1646,11 @@ void Machine::setup_linux_system_calls(bool unsafe_syscalls)
16461646
else if (cmd == F_SETFL)
16471647
{
16481648
const int writable_fd = cpu.machine().fds().translate_writable_vfd(vfd);
1649-
(void)writable_fd;
1650-
regs.rax = 0; // Ignore the new flags
1649+
const int flags = fcntl(writable_fd, cmd, regs.rdx);
1650+
if (flags < 0)
1651+
regs.rax = -errno;
1652+
else
1653+
regs.rax = 0;
16511654
}
16521655
else if (cmd == F_GETLK64)
16531656
{

0 commit comments

Comments
 (0)