Skip to content

Commit 3cb5a7f

Browse files
crassrichardweinberger
authored andcommitted
um: port_user: Improve error handling when port-helper is not found
Check if port-helper exists and is executable. If not, write an error message to the kernel log with information to help the user diagnose the issue and exit with an error. If UML_PORT_HELPER was not set, write a message suggesting that the user set it. This makes it easier to understand why telneting to the UML instance is failing and what can be done to fix it. Signed-off-by: Glenn Washburn <development@efficientek.com> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent db8109a commit 3cb5a7f

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

arch/um/drivers/port_user.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <stdio.h>
77
#include <stdlib.h>
8+
#include <string.h>
89
#include <errno.h>
910
#include <termios.h>
1011
#include <unistd.h>
@@ -179,6 +180,17 @@ int port_connection(int fd, int *socket, int *pid_out)
179180
if (new < 0)
180181
return -errno;
181182

183+
err = os_access(argv[2], X_OK);
184+
if (err < 0) {
185+
printk(UM_KERN_ERR "port_connection : error accessing port-helper "
186+
"executable at %s: %s\n", argv[2], strerror(-err));
187+
if (env == NULL)
188+
printk(UM_KERN_ERR "Set UML_PORT_HELPER environment "
189+
"variable to path to uml-utilities port-helper "
190+
"binary\n");
191+
goto out_close;
192+
}
193+
182194
err = os_pipe(socket, 0, 0);
183195
if (err < 0)
184196
goto out_close;

0 commit comments

Comments
 (0)