Deleted Added
full compact
yplib.c (228828) yplib.c (241046)
1/*
2 * Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>
3 * Copyright (c) 1998 Bill Paul <wpaul@ctr.columbia.edu>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 15 unchanged lines hidden (view full) ---

24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>
3 * Copyright (c) 1998 Bill Paul <wpaul@ctr.columbia.edu>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 15 unchanged lines hidden (view full) ---

24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/lib/libc/yp/yplib.c 228828 2011-12-23 02:13:42Z ghelmer $");
32__FBSDID("$FreeBSD: head/lib/libc/yp/yplib.c 241046 2012-09-29 11:54:34Z jilles $");
33
34#include "namespace.h"
35#include "reentrant.h"
36#include <sys/param.h>
37#include <sys/types.h>
38#include <sys/socket.h>
39#include <sys/file.h>
40#include <sys/uio.h>

--- 329 unchanged lines hidden (view full) ---

370 * existing handle now (if any).
371 */
372 if (ysd->dom_client != NULL) {
373 clnt_destroy(ysd->dom_client);
374 ysd->dom_client = NULL;
375 ysd->dom_socket = -1;
376 }
377 snprintf(path, sizeof(path), "%s/%s.%d", BINDINGDIR, dom, 2);
33
34#include "namespace.h"
35#include "reentrant.h"
36#include <sys/param.h>
37#include <sys/types.h>
38#include <sys/socket.h>
39#include <sys/file.h>
40#include <sys/uio.h>

--- 329 unchanged lines hidden (view full) ---

370 * existing handle now (if any).
371 */
372 if (ysd->dom_client != NULL) {
373 clnt_destroy(ysd->dom_client);
374 ysd->dom_client = NULL;
375 ysd->dom_socket = -1;
376 }
377 snprintf(path, sizeof(path), "%s/%s.%d", BINDINGDIR, dom, 2);
378 if ((fd = _open(path, O_RDONLY)) == -1) {
378 if ((fd = _open(path, O_RDONLY | O_CLOEXEC)) == -1) {
379 /* no binding file, YP is dead. */
380 /* Try to bring it back to life. */
381 _close(fd);
382 goto skipit;
383 }
384 if (_flock(fd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) {
385 struct iovec iov[2];
386 struct ypbind_resp ybr;

--- 834 unchanged lines hidden ---
379 /* no binding file, YP is dead. */
380 /* Try to bring it back to life. */
381 _close(fd);
382 goto skipit;
383 }
384 if (_flock(fd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) {
385 struct iovec iov[2];
386 struct ypbind_resp ybr;

--- 834 unchanged lines hidden ---