From 487b802c4a824544393fa04643e742cf3dfadde2 Mon Sep 17 00:00:00 2001 From: "Ned T. Crigler" Date: Sun, 8 May 2016 17:43:28 -0700 Subject: [PATCH] Improve error message when dtach can't find a pty. Also add some documentation mentioning the devices that dtach usually needs access to on Linux. Bug reported by David Bremner at https://bugs.debian.org/804944 --- README | 4 ++++ master.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README b/README index 3944f78..33c2d54 100644 --- a/README +++ b/README @@ -31,6 +31,10 @@ be easily portable to other variants of Unix. It currently assumes that the host system uses POSIX termios, and has a working forkpty function available. +dtach may need access to various devices in the filesystem depending on what +forkpty does. For example, dtach on Linux usually needs access to /dev/ptmx +and /dev/pts. + 2. QUICK START Compiling dtach should be simple, as it uses autoconf: diff --git a/master.c b/master.c index 90b6683..1c41bc1 100644 --- a/master.c +++ b/master.c @@ -455,7 +455,10 @@ master_process(int s, char **argv, int waitattach, int statusfd) { if (statusfd != -1) dup2(statusfd, 1); - printf("%s: init_pty: %s\n", progname, strerror(errno)); + if (errno == ENOENT) + printf("%s: Could not find a pty.\n", progname); + else + printf("%s: init_pty: %s\n", progname, strerror(errno)); exit(1); }