Deleted Added
full compact
setmode.c (280713) setmode.c (287292)
1/*
2 * Copyright (c) 1989, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Dave Borman at Cray Research, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)setmode.c 8.2 (Berkeley) 3/25/94";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1989, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Dave Borman at Cray Research, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)setmode.c 8.2 (Berkeley) 3/25/94";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/lib/libc/gen/setmode.c 280713 2015-03-26 21:58:06Z jilles $");
37__FBSDID("$FreeBSD: head/lib/libc/gen/setmode.c 287292 2015-08-29 14:25:01Z kib $");
38
39#include "namespace.h"
40#include <sys/types.h>
41#include <sys/stat.h>
42#include <sys/sysctl.h>
43
44#include <ctype.h>
45#include <errno.h>
46#include <limits.h>
47#include <signal.h>
48#include <stddef.h>
49#include <stdlib.h>
50#include <unistd.h>
51
52#ifdef SETMODE_DEBUG
53#include <stdio.h>
54#endif
55#include "un-namespace.h"
38
39#include "namespace.h"
40#include <sys/types.h>
41#include <sys/stat.h>
42#include <sys/sysctl.h>
43
44#include <ctype.h>
45#include <errno.h>
46#include <limits.h>
47#include <signal.h>
48#include <stddef.h>
49#include <stdlib.h>
50#include <unistd.h>
51
52#ifdef SETMODE_DEBUG
53#include <stdio.h>
54#endif
55#include "un-namespace.h"
56#include "libc_private.h"
56
57#define SET_LEN 6 /* initial # of bitcmd struct to malloc */
58#define SET_LEN_INCR 4 /* # of bitcmd structs to add as needed */
59
60typedef struct bitcmd {
61 char cmd;
62 char cmd2;
63 mode_t bits;

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

359 4, &smask, &len, NULL, 0) == 0)
360 return (smask);
361
362 /*
363 * Since it's possible that the caller is opening files inside a signal
364 * handler, protect them as best we can.
365 */
366 sigfillset(&sigset);
57
58#define SET_LEN 6 /* initial # of bitcmd struct to malloc */
59#define SET_LEN_INCR 4 /* # of bitcmd structs to add as needed */
60
61typedef struct bitcmd {
62 char cmd;
63 char cmd2;
64 mode_t bits;

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

360 4, &smask, &len, NULL, 0) == 0)
361 return (smask);
362
363 /*
364 * Since it's possible that the caller is opening files inside a signal
365 * handler, protect them as best we can.
366 */
367 sigfillset(&sigset);
367 (void)_sigprocmask(SIG_BLOCK, &sigset, &sigoset);
368 (void)__libc_sigprocmask(SIG_BLOCK, &sigset, &sigoset);
368 (void)umask(mask = umask(0));
369 (void)umask(mask = umask(0));
369 (void)_sigprocmask(SIG_SETMASK, &sigoset, NULL);
370 (void)__libc_sigprocmask(SIG_SETMASK, &sigoset, NULL);
370 return (mask);
371}
372
373static BITCMD *
374addcmd(BITCMD *set, mode_t op, mode_t who, mode_t oparg, mode_t mask)
375{
376 switch (op) {
377 case '=':

--- 107 unchanged lines hidden ---
371 return (mask);
372}
373
374static BITCMD *
375addcmd(BITCMD *set, mode_t op, mode_t who, mode_t oparg, mode_t mask)
376{
377 switch (op) {
378 case '=':

--- 107 unchanged lines hidden ---