diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-01-15 19:54:57 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-01-15 19:54:57 +0000 |
commit | 4406d9dba97877ef008ae0f13ea68776ca0d96f7 (patch) | |
tree | 6b95c6b790a031d495872e39b3dc7d81377d0f85 /bin/rcp/util.c | |
parent | 84f60feed4123b36d6f273cc6f9648b020d1597d (diff) |
avoid using warnx() in a signal handler, suggestion from aaron
Diffstat (limited to 'bin/rcp/util.c')
-rw-r--r-- | bin/rcp/util.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bin/rcp/util.c b/bin/rcp/util.c index cf86fa02122..e57cc00e97c 100644 --- a/bin/rcp/util.c +++ b/bin/rcp/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.7 2001/01/15 19:32:13 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.8 2001/01/15 19:54:56 deraadt Exp $ */ /* $NetBSD: util.c,v 1.2 1995/03/21 08:19:08 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)util.c 8.2 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: util.c,v 1.7 2001/01/15 19:32:13 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: util.c,v 1.8 2001/01/15 19:54:56 deraadt Exp $"; #endif #endif /* not lint */ @@ -171,7 +171,13 @@ void lostconn(signo) int signo; { - if (!iamremote) - warnx("lost connection"); + extern char *__progname; + char buf[1024]; + + if (!iamremote) { + strlcpy(buf, __progname, sizeof buf); + strlcat(buf, ": lost connection\n", sizeof buf); + write(STDERR_FILENO, buf, strlen(buf)); + } _exit(1); } |