Print this page
8699 Want NIC transceiver visibility (fix lint)
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/test/util-tests/tests/libsff/libsff_efault.c
+++ new/usr/src/test/util-tests/tests/libsff/libsff_efault.c
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 13 * Copyright (c) 2017, Joyent, Inc.
14 14 */
15 15
16 16 /*
17 17 * Test various error cases all of which should return EFAULT.
18 18 */
19 19
20 20 #include <stdio.h>
|
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
21 21 #include <errno.h>
22 22 #include <strings.h>
23 23 #include <err.h>
24 24 #include <libsff.h>
25 25 #include <unistd.h>
26 26 #include <sys/mman.h>
27 27
28 28 int
29 29 main(void)
30 30 {
31 - int ret;
32 31 void *addr;
33 32 nvlist_t *nvl;
34 33 size_t len = getpagesize();
34 + int ret;
35 35
36 36 /*
37 37 * Get an unreadable page
38 38 */
39 39 if ((addr = mmap(NULL, len, PROT_READ, MAP_PRIVATE | MAP_ANON, -1,
40 40 0)) == MAP_FAILED) {
41 41 err(1, "TEST FAILED: failed to mmap private page");
42 42 }
43 43
44 44 if (mprotect(addr, len, PROT_NONE) != 0) {
45 45 err(1, "TEST FAILED: failed to protect private page");
46 46 }
47 47
48 48 if ((ret = libsff_parse(addr, 128, 0xa0, &nvl)) != EFAULT) {
49 - errx(1, "TEST FAILED: failed to return EFAULT on bad"
50 - "data buffer\n");
49 + errx(1, "TEST FAILED: failed to return EFAULT on bad "
50 + "data buffer (%s instead)\n", strerror(ret));
51 51 }
52 52
53 53 return (0);
54 54 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX