Skip to contentSkip to conversation

virtio-9p: Allow O_NOCTTY flag in open().

PATCH New Sripathi Kodi 1 participant 1 message Aug 11, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-9p: Allow O_NOCTTY flag in open().

Currently virtio-9p server doesn't allow O_NOCTTY flag in open(). However, gcc passes this flag while opening files. As a result it is now impossible to compile any C code on the 9P mount!

I don't see any reason for dis-allowing O_NOCTTY flag in QEMU 9P server. AFAIK QEMU starts off with a controlling terminal, so calling open with O_NOCTTY flag is not going to make any difference to QEMU.

The following patch makes 9P server allow O_NOCTTY flag in open().

---

 hw/virtio-9p.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
hw/virtio-9p.c +3 -3
index 24115ef..f3b8bce 100644
@@ -1676,11 +1676,11 @@ out:
 
 static inline int valid_flags(int flag)
 {
-    if (flag & O_NOCTTY || flag & O_NONBLOCK || flag & O_ASYNC ||
-            flag & O_CLOEXEC)
+    if (flag & O_NONBLOCK || flag & O_ASYNC || flag & O_CLOEXEC) {
         return 0;
-    else
+    } else {
         return 1;
+    }
 }
 
 static void v9fs_open_post_lstat(V9fsState *s, V9fsOpenState *vs, int err)