summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ypbind/ypbind.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1995-04-02 03:10:55 +0000
committerwpaul <wpaul@FreeBSD.org>1995-04-02 03:10:55 +0000
commit3c9467d883848c3723cd56c864bc23252ee61215 (patch)
tree055cb8180f07534267e707da7c179e6cb3eb2870 /usr.sbin/ypbind/ypbind.c
parentb61a1a6addfcf030acafebf68b666580754bea2c (diff)
downloadFreeBSD-src-3c9467d883848c3723cd56c864bc23252ee61215.zip
FreeBSD-src-3c9467d883848c3723cd56c864bc23252ee61215.tar.gz
Fix long standing bogosity in ypbind: if /var/yp/binding doesn't exist,
ypbind is supposed to create it but it doesn't. This is because when it checks the return value for the attempted open() of /var/yp/binding/DOMAIN.VERSION, it tests only for a value of -1. This is bogus because open() doesn't return -1 in this case. Now it checks for < 0 instead. This should make life easier for many NIS-newbies who would otherwise be left scratching their heads wondering why the NIS client stuff won't work despite their best efforts. ("I set the domain name on my machine, and /var/yp exists, but when I start ypbind and try a 'ypcat passwd,' it says it can't bind to a server for this domain! Please help!") *long, heavy sigh*
Diffstat (limited to 'usr.sbin/ypbind/ypbind.c')
-rw-r--r--usr.sbin/ypbind/ypbind.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c
index 55c8d15..fc322a1 100644
--- a/usr.sbin/ypbind/ypbind.c
+++ b/usr.sbin/ypbind/ypbind.c
@@ -28,7 +28,7 @@
*/
#ifndef LINT
-static char rcsid[] = "$Id: ypbind.c,v 1.3 1995/02/16 01:21:44 wpaul Exp $";
+static char rcsid[] = "$Id: ypbind.c,v 1.4 1995/02/26 04:42:48 wpaul Exp $";
#endif
#include <sys/param.h>
@@ -713,15 +713,15 @@ int force;
sprintf(path, "%s/%s.%d", BINDINGDIR,
ypdb->dom_domain, ypdb->dom_vers);
#ifdef O_SHLOCK
- if( (fd=open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) == -1) {
+ if( (fd=open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) < 0) {
(void)mkdir(BINDINGDIR, 0755);
- if( (fd=open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) == -1)
+ if( (fd=open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) < 0)
return;
}
#else
- if( (fd=open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) == -1) {
+ if( (fd=open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) < 0) {
(void)mkdir(BINDINGDIR, 0755);
- if( (fd=open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) == -1)
+ if( (fd=open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) < 0)
return;
}
flock(fd, LOCK_SH);
OpenPOWER on IntegriCloud