Deleted Added
full compact
gr_util.c (244742) gr_util.c (244744)
1/*-
2 * Copyright (c) 2008 Sean C. Farley <scf@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2008 Sean C. Farley <scf@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/lib/libutil/gr_util.c 244742 2012-12-27 19:33:43Z bapt $");
28__FBSDID("$FreeBSD: head/lib/libutil/gr_util.c 244744 2012-12-27 20:24:44Z bapt $");
29
30#include <sys/param.h>
31#include <sys/errno.h>
32#include <sys/stat.h>
33
34#include <ctype.h>
35#include <err.h>
36#include <fcntl.h>

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

96gr_lock(void)
97{
98 if (*group_file == '\0')
99 return (-1);
100
101 for (;;) {
102 struct stat st;
103
29
30#include <sys/param.h>
31#include <sys/errno.h>
32#include <sys/stat.h>
33
34#include <ctype.h>
35#include <err.h>
36#include <fcntl.h>

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

96gr_lock(void)
97{
98 if (*group_file == '\0')
99 return (-1);
100
101 for (;;) {
102 struct stat st;
103
104 lockfd = flopen(group_file, O_RDONLY|O_NONBLOCK, 0);
104 lockfd = flopen(group_file, O_RDONLY|O_NONBLOCK|O_CLOEXEC, 0);
105 if (lockfd == -1) {
106 if (errno == EWOULDBLOCK) {
107 errx(1, "the group file is busy");
108 } else {
109 err(1, "could not lock the group file: ");
110 }
111 }
112 if (fstat(lockfd, &st) == -1)

--- 475 unchanged lines hidden ---
105 if (lockfd == -1) {
106 if (errno == EWOULDBLOCK) {
107 errx(1, "the group file is busy");
108 } else {
109 err(1, "could not lock the group file: ");
110 }
111 }
112 if (fstat(lockfd, &st) == -1)

--- 475 unchanged lines hidden ---