Fix last bug correctly

This commit is contained in:
pk 1994-06-03 15:02:21 +00:00
parent 8aa1346476
commit fc016a129a
1 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)res_query.c 5.11 (Berkeley) 3/6/91";*/
static char *rcsid = "$Id: res_query.c,v 1.5 1994/06/01 19:54:07 pk Exp $";
static char *rcsid = "$Id: res_query.c,v 1.6 1994/06/03 15:02:21 pk Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@ -287,13 +287,13 @@ res_querydomain(name, domain, class, type, answer, anslen)
printf(";; res_querydomain(%s, %s, %d, %d)\n",
name, domain, class, type);
#endif
if (domain == NULL && *name != '\0') {
if (domain == NULL) {
/*
* Check for trailing '.';
* copy without '.' if present.
*/
n = strlen(name) - 1;
if (name[n] == '.' && n < sizeof(nbuf) - 1) {
if (n != (0 - 1) && name[n] == '.' && n < sizeof(nbuf) - 1) {
bcopy(name, nbuf, n);
nbuf[n] = '\0';
} else