summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2009-06-05 16:39:40 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2009-06-05 16:39:40 +0000
commit15701c5776fb689d1fff7a304ea2e3d4b72a122f (patch)
tree3044f0f5c2ff4a29329f776796c2ebace25819b3 /lib/libc
parenta60864fe4e9e35c14714197a96687b820589824c (diff)
An empty sting cannot be used as a YP domain name,
so treat it similarly to a failing call to getdomainname. ok millert@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/yp/yp_get_default_domain.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/yp/yp_get_default_domain.c b/lib/libc/yp/yp_get_default_domain.c
index a752e094e9e..d48e3d1eddf 100644
--- a/lib/libc/yp/yp_get_default_domain.c
+++ b/lib/libc/yp/yp_get_default_domain.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: yp_get_default_domain.c,v 1.6 2005/08/05 13:02:16 espie Exp $ */
+/* $OpenBSD: yp_get_default_domain.c,v 1.7 2009/06/05 16:39:39 schwarze Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@theos.com>
* All rights reserved.
@@ -42,5 +42,7 @@ yp_get_default_domain(char **domp)
if (getdomainname(_yp_domain, sizeof _yp_domain))
return YPERR_NODOM;
*domp = _yp_domain;
+ if (_yp_domain[0] == '\0')
+ return YPERR_NODOM;
return 0;
}