diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-09-05 14:04:34 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-09-05 14:04:34 +0000 |
commit | 13593e3a04409abc07fdcc8559c2c7b15b35bbe1 (patch) | |
tree | c0fe9ba24c80fe16a6567c6ecbe30819bc7b8ebd /lib | |
parent | 6aac782f1d699d4e63c71901fa38466423e5bffb (diff) |
rather than assuming stderr is alive, open + dprintf to /dev/tty
ok guenther millert
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/yp/yp_bind.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/libc/yp/yp_bind.c b/lib/libc/yp/yp_bind.c index 73cbd3888b2..16216cc5294 100644 --- a/lib/libc/yp/yp_bind.c +++ b/lib/libc/yp/yp_bind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yp_bind.c,v 1.22 2015/01/16 16:48:51 deraadt Exp $ */ +/* $OpenBSD: yp_bind.c,v 1.23 2015/09/05 14:04:33 deraadt Exp $ */ /* * Copyright (c) 1992, 1993, 1996 Theo de Raadt <deraadt@theos.com> * All rights reserved. @@ -35,6 +35,8 @@ #include <string.h> #include <unistd.h> #include <limits.h> +#include <paths.h> + #include <rpc/rpc.h> #include <rpc/xdr.h> #include <rpcsvc/yp.h> @@ -189,10 +191,18 @@ trynet: r = clnt_call(client, YPBINDPROC_DOMAIN, xdr_domainname, &dom, xdr_ypbind_resp, &ypbr, tv); if (r != RPC_SUCCESS) { - if (new == 0 || count) - fprintf(stderr, - "YP server for domain %s not responding, still trying\n", - dom); + if (new == 0 || count) { + int fd; + + fd = open(_PATH_TTY, + O_WRONLY | O_NONBLOCK | O_NOCTTY); + if (fd != -1) { + dprintf(fd, + "YP server for domain %s not responding, still trying\n", + dom); + close(fd); + } + } count++; clnt_destroy(client); ysd->dom_vers = -1; |