diff options
author | Glenn Washburn <development@efficientek.com> | 2022-03-03 01:53:32 -0600 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2022-03-11 10:55:55 +0100 |
commit | 3cb5a7f167c620a8b0e38b0446df2e024d2243dc (patch) | |
tree | 621f747bf971f971f1e5a9415aa58f34a6aa6b89 /arch/um | |
parent | db8109a8bb4a4b31e7f630d7667749d62ee4a087 (diff) | |
download | linux-next-3cb5a7f167c620a8b0e38b0446df2e024d2243dc.tar.gz |
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>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/drivers/port_user.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c index 3e32351dadad..3c62ae81df62 100644 --- a/arch/um/drivers/port_user.c +++ b/arch/um/drivers/port_user.c @@ -5,6 +5,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <errno.h> #include <termios.h> #include <unistd.h> @@ -179,6 +180,17 @@ int port_connection(int fd, int *socket, int *pid_out) if (new < 0) return -errno; + err = os_access(argv[2], X_OK); + if (err < 0) { + printk(UM_KERN_ERR "port_connection : error accessing port-helper " + "executable at %s: %s\n", argv[2], strerror(-err)); + if (env == NULL) + printk(UM_KERN_ERR "Set UML_PORT_HELPER environment " + "variable to path to uml-utilities port-helper " + "binary\n"); + goto out_close; + } + err = os_pipe(socket, 0, 0); if (err < 0) goto out_close; |