Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74ff582c authored by Amit Shah's avatar Amit Shah Committed by Rusty Russell
Browse files

virtio: console: replace EMFILE with EBUSY for already-open port



Returning EMFILE (process has too many open files) is incorrect to
indicate a port is already open by another process.  Use EBUSY for that.

This does change what we report to userspace, but I believe userspace
can look at it this way: it gets EBUSY, a new error code, instead of
EMFILE.  It's still an error, and that's not changing.

Reported-by: default avatarMateusz Guzik <mguzik@redhat.com>
Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 285e71ea
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1036,7 +1036,7 @@ static int port_fops_open(struct inode *inode, struct file *filp)
	spin_lock_irq(&port->inbuf_lock);
	spin_lock_irq(&port->inbuf_lock);
	if (port->guest_connected) {
	if (port->guest_connected) {
		spin_unlock_irq(&port->inbuf_lock);
		spin_unlock_irq(&port->inbuf_lock);
		ret = -EMFILE;
		ret = -EBUSY;
		goto out;
		goto out;
	}
	}