gethostbydns.c (126243) | gethostbydns.c (126643) |
---|---|
1/* 2 * ++Copyright++ 1985, 1988, 1993 3 * - 4 * Copyright (c) 1985, 1988, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 44 unchanged lines hidden (view full) --- 53 * --Copyright-- 54 */ 55 56#if defined(LIBC_SCCS) && !defined(lint) 57static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; 58static char fromrcsid[] = "From: Id: gethnamaddr.c,v 8.23 1998/04/07 04:59:46 vixie Exp $"; 59#endif /* LIBC_SCCS and not lint */ 60#include <sys/cdefs.h> | 1/* 2 * ++Copyright++ 1985, 1988, 1993 3 * - 4 * Copyright (c) 1985, 1988, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 44 unchanged lines hidden (view full) --- 53 * --Copyright-- 54 */ 55 56#if defined(LIBC_SCCS) && !defined(lint) 57static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; 58static char fromrcsid[] = "From: Id: gethnamaddr.c,v 8.23 1998/04/07 04:59:46 vixie Exp $"; 59#endif /* LIBC_SCCS and not lint */ 60#include <sys/cdefs.h> |
61__FBSDID("$FreeBSD: head/lib/libc/net/gethostbydns.c 126243 2004-02-25 21:03:46Z green $"); | 61__FBSDID("$FreeBSD: head/lib/libc/net/gethostbydns.c 126643 2004-03-05 08:10:19Z markm $"); |
62 63#include <sys/types.h> 64#include <sys/param.h> 65#include <sys/socket.h> 66#include <netinet/in.h> 67#include <arpa/inet.h> 68#include <arpa/nameser.h> 69 --- 516 unchanged lines hidden (view full) --- 586 if ((buf = malloc(sizeof(*buf))) == NULL) { 587 h_errno = NETDB_INTERNAL; 588 return NS_NOTFOUND; 589 } 590 n = res_search(name, C_IN, type, buf->buf, sizeof(buf->buf)); 591 if (n < 0) { 592 free(buf); 593 dprintf("res_search failed (%d)\n", n); | 62 63#include <sys/types.h> 64#include <sys/param.h> 65#include <sys/socket.h> 66#include <netinet/in.h> 67#include <arpa/inet.h> 68#include <arpa/nameser.h> 69 --- 516 unchanged lines hidden (view full) --- 586 if ((buf = malloc(sizeof(*buf))) == NULL) { 587 h_errno = NETDB_INTERNAL; 588 return NS_NOTFOUND; 589 } 590 n = res_search(name, C_IN, type, buf->buf, sizeof(buf->buf)); 591 if (n < 0) { 592 free(buf); 593 dprintf("res_search failed (%d)\n", n); |
594 return (NULL); | 594 return (0); |
595 } else if (n > sizeof(buf->buf)) { 596 free(buf); 597 dprintf("static buffer is too small (%d)\n", n); | 595 } else if (n > sizeof(buf->buf)) { 596 free(buf); 597 dprintf("static buffer is too small (%d)\n", n); |
598 return (NULL); | 598 return (0); |
599 } 600 *(struct hostent **)rval = gethostanswer(buf, n, name, type); 601 free(buf); 602 return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND; 603} 604 605int 606_dns_gethostbyaddr(void *rval, void *cb_data, va_list ap) --- 207 unchanged lines hidden --- | 599 } 600 *(struct hostent **)rval = gethostanswer(buf, n, name, type); 601 free(buf); 602 return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND; 603} 604 605int 606_dns_gethostbyaddr(void *rval, void *cb_data, va_list ap) --- 207 unchanged lines hidden --- |