summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/lib/libc
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-05-04 00:29:05 +0000
committerngie <ngie@FreeBSD.org>2016-05-04 00:29:05 +0000
commite47fda35686eefd0d999881cb8255c6bc4092112 (patch)
tree2444c93e49324aa7068ead8b840cc7baff60c6eb /contrib/netbsd-tests/lib/libc
parent2a062cd701612c43c2847135646eb984789b4396 (diff)
downloadFreeBSD-src-e47fda35686eefd0d999881cb8255c6bc4092112.zip
FreeBSD-src-e47fda35686eefd0d999881cb8255c6bc4092112.tar.gz
MFC r298368,r298660:
r298368: Fix coverity issue with contrib/netbsd-tests/lib/libc/ssp/h_read.c Ensure opening /dev/zero succeeds. Abort the test if it doesn't. Also, use _PATH_DEVZERO instead of hardcoding "/dev/zero" CID: 1251410 r298660: Fix up r298368 Remove the semicolon accidentally added after the new conditional that tests that /dev/zero is opened successfully. CID: 1354980
Diffstat (limited to 'contrib/netbsd-tests/lib/libc')
-rw-r--r--contrib/netbsd-tests/lib/libc/ssp/h_read.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/netbsd-tests/lib/libc/ssp/h_read.c b/contrib/netbsd-tests/lib/libc/ssp/h_read.c
index 1197b6c..c25cfeb 100644
--- a/contrib/netbsd-tests/lib/libc/ssp/h_read.c
+++ b/contrib/netbsd-tests/lib/libc/ssp/h_read.c
@@ -38,6 +38,7 @@ __RCSID("$NetBSD: h_read.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
#ifdef __FreeBSD__
#include <fcntl.h>
+#include <paths.h>
int
main(int argc, char *argv[])
@@ -46,7 +47,8 @@ main(int argc, char *argv[])
int fd, n;
size_t len = atoi(argv[1]);
- fd = open("/dev/zero", O_RDONLY);
+ if ((fd = open(_PATH_DEVZERO, O_RDONLY)) == -1)
+ abort();
if ((n = read(fd, b, len)) == -1)
abort();
(void)printf("%s\n", b);
OpenPOWER on IntegriCloud