Skip to content
  • Sripathi Kodi's avatar
    [virtio-9p] open should not return EBADF · ab03b63d
    Sripathi Kodi authored
    
    
    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: default avatarSripathi Kodi <sripathik@in.ibm.com>
    Signed-off-by: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
    ab03b63d