Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests PR misc/54382: whenever open(2) is called with O_CREAT...
details: https://anonhg.NetBSD.org/src/rev/aee5e8045c5f
branches: trunk
changeset: 962370:aee5e8045c5f
user: martin <martin%NetBSD.org@localhost>
date: Tue Jul 16 17:29:17 2019 +0000
description:
PR misc/54382: whenever open(2) is called with O_CREAT, make sure to
pass an open mode argument.
diffstat:
tests/fs/nfs/t_mountd.c | 4 ++--
tests/fs/union/t_pr.c | 6 +++---
tests/fs/vfs/t_full.c | 4 ++--
tests/fs/vfs/t_io.c | 4 ++--
tests/fs/vfs/t_ro.c | 5 +++--
tests/lib/libc/gen/t_ftok.c | 6 +++---
tests/lib/libc/stdio/t_fopen.c | 10 +++++-----
tests/lib/libc/sys/t_access.c | 6 +++---
tests/lib/libc/sys/t_mprotect.c | 6 +++---
tests/lib/libc/sys/t_stat.c | 14 +++++++-------
tests/lib/libc/sys/t_write.c | 10 +++++-----
tests/rump/rumpkern/h_client/h_forkcli.c | 4 ++--
12 files changed, 40 insertions(+), 39 deletions(-)
diffs (truncated from 352 to 300 lines):
diff -r a1316eaffeed -r aee5e8045c5f tests/fs/nfs/t_mountd.c
--- a/tests/fs/nfs/t_mountd.c Tue Jul 16 16:18:56 2019 +0000
+++ b/tests/fs/nfs/t_mountd.c Tue Jul 16 17:29:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mountd.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */
+/* $NetBSD: t_mountd.c,v 1.7 2019/07/16 17:29:17 martin Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
rump_sys_chdir(FSTEST_MNTNAME);
while (!quit) {
- fd = rump_sys_open("file", O_RDWR | O_CREAT);
+ fd = rump_sys_open("file", O_RDWR | O_CREAT, 0600);
if (fd == -1) {
if (errno == EACCES) {
fail++;
diff -r a1316eaffeed -r aee5e8045c5f tests/fs/union/t_pr.c
--- a/tests/fs/union/t_pr.c Tue Jul 16 16:18:56 2019 +0000
+++ b/tests/fs/union/t_pr.c Tue Jul 16 17:29:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pr.c,v 1.12 2017/04/14 01:30:38 riastradh Exp $ */
+/* $NetBSD: t_pr.c,v 1.13 2019/07/16 17:29:17 martin Exp $ */
#include <sys/types.h>
#include <sys/mount.h>
@@ -186,7 +186,7 @@
&unionargs, sizeof(unionargs)) == -1)
atf_tc_fail_errno("union mount");
- fd = rump_sys_open("/mp/null", O_WRONLY | O_CREAT | O_TRUNC);
+ fd = rump_sys_open("/mp/null", O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd == -1)
atf_tc_fail_errno("open");
@@ -220,7 +220,7 @@
&unionargs, sizeof(unionargs)) == -1)
atf_tc_fail_errno("union mount");
- fd = rump_sys_open("/mp/null", O_WRONLY | O_CREAT | O_APPEND);
+ fd = rump_sys_open("/mp/null", O_WRONLY | O_CREAT | O_APPEND, 0600);
if (fd == -1)
atf_tc_fail_errno("open");
diff -r a1316eaffeed -r aee5e8045c5f tests/fs/vfs/t_full.c
--- a/tests/fs/vfs/t_full.c Tue Jul 16 16:18:56 2019 +0000
+++ b/tests/fs/vfs/t_full.c Tue Jul 16 17:29:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_full.c,v 1.10 2018/11/30 09:52:39 hannken Exp $ */
+/* $NetBSD: t_full.c,v 1.11 2019/07/16 17:29:17 martin Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
if (rump_sys_chdir(mp) == -1)
atf_tc_fail_errno("chdir mountpoint");
- fd = rump_sys_open("afile", O_CREAT | O_RDWR);
+ fd = rump_sys_open("afile", O_CREAT | O_RDWR, 0600);
if (fd == -1)
atf_tc_fail_errno("create file");
diff -r a1316eaffeed -r aee5e8045c5f tests/fs/vfs/t_io.c
--- a/tests/fs/vfs/t_io.c Tue Jul 16 16:18:56 2019 +0000
+++ b/tests/fs/vfs/t_io.c Tue Jul 16 17:29:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_io.c,v 1.17 2017/01/13 21:30:40 christos Exp $ */
+/* $NetBSD: t_io.c,v 1.18 2019/07/16 17:29:17 martin Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -85,7 +85,7 @@
FSTEST_ENTER();
RL(fd = rump_sys_open("testfile",
- O_CREAT | O_RDWR | (seekcnt ? O_APPEND : 0)));
+ O_CREAT | O_RDWR | (seekcnt ? O_APPEND : 0)), 0600);
RL(rump_sys_ftruncate(fd, seekcnt));
RL(rump_sys_fstat(fd, &sb));
ATF_REQUIRE_EQ(sb.st_size, seekcnt);
diff -r a1316eaffeed -r aee5e8045c5f tests/fs/vfs/t_ro.c
--- a/tests/fs/vfs/t_ro.c Tue Jul 16 16:18:56 2019 +0000
+++ b/tests/fs/vfs/t_ro.c Tue Jul 16 17:29:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ro.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */
+/* $NetBSD: t_ro.c,v 1.7 2019/07/16 17:29:17 martin Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -79,7 +79,8 @@
{
FSTEST_ENTER();
- ATF_REQUIRE_ERRNO(EROFS, rump_sys_open(AFILE, O_CREAT|O_RDONLY) == -1);
+ ATF_REQUIRE_ERRNO(EROFS, rump_sys_open(AFILE, O_CREAT|O_RDONLY,
+ 0600) == -1);
FSTEST_EXIT();
}
diff -r a1316eaffeed -r aee5e8045c5f tests/lib/libc/gen/t_ftok.c
--- a/tests/lib/libc/gen/t_ftok.c Tue Jul 16 16:18:56 2019 +0000
+++ b/tests/lib/libc/gen/t_ftok.c Tue Jul 16 17:29:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ftok.c,v 1.2 2017/01/10 15:19:52 christos Exp $ */
+/* $NetBSD: t_ftok.c,v 1.3 2019/07/16 17:29:18 martin Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ftok.c,v 1.2 2017/01/10 15:19:52 christos Exp $");
+__RCSID("$NetBSD: t_ftok.c,v 1.3 2019/07/16 17:29:18 martin Exp $");
#include <sys/types.h>
#include <sys/ipc.h>
@@ -65,7 +65,7 @@
key_t k1, k2, k3;
int fd;
- fd = open(path, O_RDONLY | O_CREAT);
+ fd = open(path, O_RDONLY | O_CREAT, 0600);
ATF_REQUIRE(fd >= 0);
(void)close(fd);
diff -r a1316eaffeed -r aee5e8045c5f tests/lib/libc/stdio/t_fopen.c
--- a/tests/lib/libc/stdio/t_fopen.c Tue Jul 16 16:18:56 2019 +0000
+++ b/tests/lib/libc/stdio/t_fopen.c Tue Jul 16 17:29:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fopen.c,v 1.6 2019/02/05 17:30:19 kamil Exp $ */
+/* $NetBSD: t_fopen.c,v 1.7 2019/07/16 17:29:18 martin Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fopen.c,v 1.6 2019/02/05 17:30:19 kamil Exp $");
+__RCSID("$NetBSD: t_fopen.c,v 1.7 2019/07/16 17:29:18 martin Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -62,7 +62,7 @@
* used to fdopen(3) a stream is
* closed once the stream is closed.
*/
- fd = open(path, O_RDWR | O_CREAT);
+ fd = open(path, O_RDWR | O_CREAT, 0600);
ATF_REQUIRE(fd >= 0);
@@ -89,7 +89,7 @@
{
int fd;
- fd = open(path, O_RDONLY | O_CREAT);
+ fd = open(path, O_RDONLY | O_CREAT, 0600);
ATF_REQUIRE(fd >= 0);
errno = 0;
@@ -130,7 +130,7 @@
* with the stream corresponds with the offset
* set earlier for the file descriptor.
*/
- fd = open(path, O_RDWR | O_CREAT);
+ fd = open(path, O_RDWR | O_CREAT, 0600);
ATF_REQUIRE(fd >= 0);
ATF_REQUIRE(write(fd, "garbage", 7) == 7);
diff -r a1316eaffeed -r aee5e8045c5f tests/lib/libc/sys/t_access.c
--- a/tests/lib/libc/sys/t_access.c Tue Jul 16 16:18:56 2019 +0000
+++ b/tests/lib/libc/sys/t_access.c Tue Jul 16 17:29:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $ */
+/* $NetBSD: t_access.c,v 1.3 2019/07/16 17:29:18 martin Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $");
+__RCSID("$NetBSD: t_access.c,v 1.3 2019/07/16 17:29:18 martin Exp $");
#include <atf-c.h>
@@ -58,7 +58,7 @@
size_t i;
int fd;
- fd = open(path, O_RDONLY | O_CREAT);
+ fd = open(path, O_RDONLY | O_CREAT, 0600);
if (fd < 0)
return;
diff -r a1316eaffeed -r aee5e8045c5f tests/lib/libc/sys/t_mprotect.c
--- a/tests/lib/libc/sys/t_mprotect.c Tue Jul 16 16:18:56 2019 +0000
+++ b/tests/lib/libc/sys/t_mprotect.c Tue Jul 16 17:29:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mprotect.c,v 1.7 2017/05/06 21:34:52 joerg Exp $ */
+/* $NetBSD: t_mprotect.c,v 1.8 2019/07/16 17:29:18 martin Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mprotect.c,v 1.7 2017/05/06 21:34:52 joerg Exp $");
+__RCSID("$NetBSD: t_mprotect.c,v 1.8 2019/07/16 17:29:18 martin Exp $");
#include <sys/param.h>
#include <sys/mman.h>
@@ -87,7 +87,7 @@
size_t i;
int fd;
- fd = open(path, O_RDONLY | O_CREAT);
+ fd = open(path, O_RDONLY | O_CREAT, 0600);
ATF_REQUIRE(fd >= 0);
/*
diff -r a1316eaffeed -r aee5e8045c5f tests/lib/libc/sys/t_stat.c
--- a/tests/lib/libc/sys/t_stat.c Tue Jul 16 16:18:56 2019 +0000
+++ b/tests/lib/libc/sys/t_stat.c Tue Jul 16 17:29:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $ */
+/* $NetBSD: t_stat.c,v 1.6 2019/07/16 17:29:18 martin Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $");
+__RCSID("$NetBSD: t_stat.c,v 1.6 2019/07/16 17:29:18 martin Exp $");
#include <sys/stat.h>
#include <sys/socket.h>
@@ -64,7 +64,7 @@
(void)memset(&sa, 0, sizeof(struct stat));
(void)memset(&sb, 0, sizeof(struct stat));
- fd = open(path, O_RDONLY | O_CREAT);
+ fd = open(path, O_RDONLY | O_CREAT, 0600);
ATF_REQUIRE(fd != -1);
ATF_REQUIRE(stat(path, &sa) == 0);
@@ -210,7 +210,7 @@
(void)memset(&sa, 0, sizeof(struct stat));
(void)memset(&sb, 0, sizeof(struct stat));
- fd[i] = open(path, O_WRONLY | O_CREAT);
+ fd[i] = open(path, O_WRONLY | O_CREAT, 0600);
ATF_REQUIRE(fd[i] != -1);
ATF_REQUIRE(write(fd[i], "X", 1) == 1);
@@ -254,7 +254,7 @@
uid = getuid();
gid = getgid();
- fd = open(path, O_RDONLY | O_CREAT);
+ fd = open(path, O_RDONLY | O_CREAT, 0600);
ATF_REQUIRE(fd != -1);
ATF_REQUIRE(fstat(fd, &sa) == 0);
@@ -288,7 +288,7 @@
size_t i;
int fd;
- fd = open(path, O_WRONLY | O_CREAT);
+ fd = open(path, O_WRONLY | O_CREAT, 0600);
ATF_REQUIRE(fd >= 0);
for (i = 0; i < n; i++) {
@@ -377,7 +377,7 @@
(void)memset(&sa, 0, sizeof(struct stat));
(void)memset(&sb, 0, sizeof(struct stat));
- fd = open(path, O_WRONLY | O_CREAT);
+ fd = open(path, O_WRONLY | O_CREAT, 0600);
ATF_REQUIRE(fd >= 0);
ATF_REQUIRE(symlink(path, pathlink) == 0);
diff -r a1316eaffeed -r aee5e8045c5f tests/lib/libc/sys/t_write.c
--- a/tests/lib/libc/sys/t_write.c Tue Jul 16 16:18:56 2019 +0000
+++ b/tests/lib/libc/sys/t_write.c Tue Jul 16 17:29:17 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_write.c,v 1.6 2017/07/09 22:18:43 christos Exp $ */
+/* $NetBSD: t_write.c,v 1.7 2019/07/16 17:29:18 martin Exp $ */
/*-
* Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
Home |
Main Index |
Thread Index |
Old Index