Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/kernel * Use 'struct testmsg' rather than 'struct myms...
details: https://anonhg.NetBSD.org/src/rev/974ec734c125
branches: trunk
changeset: 359174:974ec734c125
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Sat Feb 03 02:57:15 2018 +0000
description:
* Use 'struct testmsg' rather than 'struct mymsg' (avoids a conflict
with FreeBSD)
* Fix a broken call to open(2) with O_CREAT and no permission argument.
* ANSIfy function definitions.
* Improve failure messages.
>From freebsd.org via Brooks Davis - Thanks!
diffstat:
tests/kernel/t_sysv.c | 32 ++++++++++++++------------------
1 files changed, 14 insertions(+), 18 deletions(-)
diffs (113 lines):
diff -r 253190fabc01 -r 974ec734c125 tests/kernel/t_sysv.c
--- a/tests/kernel/t_sysv.c Fri Feb 02 20:57:53 2018 +0000
+++ b/tests/kernel/t_sysv.c Sat Feb 03 02:57:15 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sysv.c,v 1.4 2014/03/02 20:13:12 jmmv Exp $ */
+/* $NetBSD: t_sysv.c,v 1.5 2018/02/03 02:57:15 pgoyette Exp $ */
/*-
* Copyright (c) 1999, 2007 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
#define MESSAGE_TEXT_LEN 256
-struct mymsg {
+struct testmsg {
long mtype;
char mtext[MESSAGE_TEXT_LEN];
};
@@ -174,7 +174,7 @@
/* Create the file, since ftok() requires it to exist! */
- fd = open(token_key, O_RDWR | O_CREAT | O_EXCL);
+ fd = open(token_key, O_RDWR | O_CREAT | O_EXCL, 0600);
if (fd == -1) {
rmdir(tmpdir);
atf_tc_fail("open() of temp file failed: %d", errno);
@@ -183,6 +183,7 @@
close(fd);
key = ftok(token_key, id);
+ ATF_REQUIRE_MSG(key != (key_t)-1, "ftok() failed");
ATF_REQUIRE_MSG(unlink(token_key) != -1, "unlink() failed: %d", errno);
ATF_REQUIRE_MSG(rmdir(token_dir) != -1, "rmdir() failed: %d", errno);
@@ -202,7 +203,7 @@
{
struct sigaction sa;
struct msqid_ds m_ds;
- struct mymsg m;
+ struct testmsg m;
sigset_t sigmask;
int sender_msqid;
int loop;
@@ -347,9 +348,7 @@
}
void
-print_msqid_ds(mp, mode)
- struct msqid_ds *mp;
- mode_t mode;
+print_msqid_ds(struct msqid_ds *mp, mode_t mode)
{
uid_t uid = geteuid();
gid_t gid = getegid();
@@ -381,9 +380,9 @@
}
void
-receiver()
+receiver(void)
{
- struct mymsg m;
+ struct testmsg m;
int msqid, loop;
if ((msqid = msgget(msgkey, 0)) == -1)
@@ -588,9 +587,7 @@
}
void
-print_semid_ds(sp, mode)
- struct semid_ds *sp;
- mode_t mode;
+print_semid_ds(struct semid_ds *sp, mode_t mode)
{
uid_t uid = geteuid();
gid_t gid = getegid();
@@ -620,7 +617,7 @@
}
void
-waiter()
+waiter(void)
{
struct sembuf s;
int semid;
@@ -789,9 +786,7 @@
}
void
-print_shmid_ds(sp, mode)
- struct shmid_ds *sp;
- mode_t mode;
+print_shmid_ds(struct shmid_ds *sp, mode_t mode)
{
uid_t uid = geteuid();
gid_t gid = getegid();
@@ -819,11 +814,12 @@
ATF_REQUIRE_MSG(sp->shm_perm.gid == gid && sp->shm_perm.cgid == gid,
"gid mismatch");
- ATF_REQUIRE_MSG((sp->shm_perm.mode & 0777) == mode, "mode mismatch");
+ ATF_REQUIRE_MSG((sp->shm_perm.mode & 0777) == mode,
+ "mode mismatch %o != %o", sp->shm_perm.mode & 0777, mode);
}
void
-sharer()
+sharer(void)
{
int shmid;
void *shm_buf;
Home |
Main Index |
Thread Index |
Old Index