]> git.proxmox.com Git - mirror_qemu.git/commit
[virtio-9p] open should not return EBADF
authorSripathi Kodi <sripathik@in.ibm.com>
Mon, 20 Sep 2010 17:54:29 +0000 (23:24 +0530)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 20 Oct 2010 17:10:58 +0000 (12:10 -0500)
commitab03b63d7a9c7978d51e56c191f0b86888d121dc
treecac6eeb4fe977ef75a62a34a31379ca501e4e572
parenta12c668f0a44bbbb7b9bc2b852c62f6864c8b92d
[virtio-9p] open should not return EBADF

When 9P server fails to create a file due to permission problems it should
return EPERM. However the current 9P2000.L code returns EBADF. EBADF is NOT
a valid return value from open() call.

The problem is because we do not preserve the errno variable properly. If the
file open had failed, the call to close() on the fd in v9fs_post_lcreate()
fails and sets errno to EBADF. We should preserve the errno that we got from
open() and we should call close() only if we had a valid fd.

Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
hw/virtio-9p.c