From: gene Date: Sat, 15 Mar 1997 00:08:58 +0000 (+0000) Subject: Fix so yppush will err out if it can't find the ypservers map. This whole X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cb5c1760242fe6dbf67ec0b494e3f09eb0354692;p=openbsd Fix so yppush will err out if it can't find the ypservers map. This whole code wants lots of attention, but at least it won't dump core on a virgin installation now. --- diff --git a/usr.sbin/ypserv/yppush/yppush.c b/usr.sbin/ypserv/yppush/yppush.c index c17db8448d2..a4e774e4692 100644 --- a/usr.sbin/ypserv/yppush/yppush.c +++ b/usr.sbin/ypserv/yppush/yppush.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush.c,v 1.5 1996/12/14 22:10:27 maja Exp $ */ +/* $OpenBSD: yppush.c,v 1.6 1997/03/15 00:08:58 gene Exp $ */ /* * Copyright (c) 1995 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: yppush.c,v 1.5 1996/12/14 22:10:27 maja Exp $"; +static char rcsid[] = "$OpenBSD: yppush.c,v 1.6 1997/03/15 00:08:58 gene Exp $"; #endif /* not lint */ #include @@ -281,6 +281,7 @@ char **argv; exit(1); } + /* Check map */ snprintf(map_path,sizeof map_path,"%s/%s/%s%s", YP_DB_PATH,domain,Map,YPDB_SUFFIX); @@ -324,7 +325,11 @@ char **argv; yp_bind(Domain); - r = yp_master(Domain, ypmap, &master); + r = yp_master(Domain, ypmap, &master); + if (r != 0) { + fprintf(stderr, "yppush: could not get ypservers map\n"); + exit(1); + } if (hostname != NULL) { push(strlen(hostname), hostname);