Deleted Added
full compact
fifo_open.c (281414) fifo_open.c (281450)
1/*-
2 * Copyright (c) 2005 Robert N. M. Watson
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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2005 Robert N. M. Watson
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

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

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: user/ngie/more-tests/tools/regression/fifo/fifo_open/fifo_open.c 150031 2005-09-12 11:43:51Z rwatson $
26 * $FreeBSD: user/ngie/more-tests/tests/sys/fifo/fifo_open.c 281450 2015-04-12 06:18:24Z ngie $
27 */
28
29#include <sys/types.h>
30#include <sys/stat.h>
31#include <sys/wait.h>
32
33#include <err.h>
34#include <errno.h>

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

82 * create or unlink it) in order to avoid the main test process being
83 * blocked.
84 */
85
86/*
87 * All activity occurs within a temporary directory created early in the
88 * test.
89 */
27 */
28
29#include <sys/types.h>
30#include <sys/stat.h>
31#include <sys/wait.h>
32
33#include <err.h>
34#include <errno.h>

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

82 * create or unlink it) in order to avoid the main test process being
83 * blocked.
84 */
85
86/*
87 * All activity occurs within a temporary directory created early in the
88 * test.
89 */
90char temp_dir[PATH_MAX];
90static char temp_dir[PATH_MAX];
91
92static void __unused
93atexit_temp_dir(void)
94{
95
96 rmdir(temp_dir);
97}
98

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

448 "non_blocking_open_writer: open: testfifo");
449 }
450
451 if (unlink("testfifo") < 0)
452 err(-1, "test_non_blocking_writer: unlink: testfifo");
453}
454
455int
91
92static void __unused
93atexit_temp_dir(void)
94{
95
96 rmdir(temp_dir);
97}
98

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

448 "non_blocking_open_writer: open: testfifo");
449 }
450
451 if (unlink("testfifo") < 0)
452 err(-1, "test_non_blocking_writer: unlink: testfifo");
453}
454
455int
456main(int argc, char *argv[])
456main(void)
457{
458
459 if (geteuid() != 0)
460 errx(-1, "must be run as root");
461
457{
458
459 if (geteuid() != 0)
460 errx(-1, "must be run as root");
461
462 strcpy(temp_dir, "/tmp/fifo_open.XXXXXXXXXXX");
462 strcpy(temp_dir, "fifo_open.XXXXXXXXXXX");
463 if (mkdtemp(temp_dir) == NULL)
464 err(-1, "mkdtemp");
465 if (chdir(temp_dir) < 0)
466 err(-1, "chdir: %s", temp_dir);
467 atexit(atexit_temp_dir);
468
469 test_non_blocking_reader();
470 test_non_blocking_writer();
471
472 test_blocking_reader();
473 test_blocking_writer();
474
475 return (0);
476}
463 if (mkdtemp(temp_dir) == NULL)
464 err(-1, "mkdtemp");
465 if (chdir(temp_dir) < 0)
466 err(-1, "chdir: %s", temp_dir);
467 atexit(atexit_temp_dir);
468
469 test_non_blocking_reader();
470 test_non_blocking_writer();
471
472 test_blocking_reader();
473 test_blocking_writer();
474
475 return (0);
476}