Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/regress/lib/libc/siginfo Writing to address 0x5a5a5a5a does ...



details:   https://anonhg.NetBSD.org/src/rev/b1168509cced
branches:  trunk
changeset: 553204:b1168509cced
user:      pk <pk%NetBSD.org@localhost>
date:      Sun Oct 12 17:13:46 2003 +0000

description:
Writing to address 0x5a5a5a5a does not guarantee a SIGSEGV on all platforms
(e.g. on sparc, this produces a BUSERR). Just use a NUL pointer instead.

diffstat:

 regress/lib/libc/siginfo/sigchld/sigchld.c |  2 +-
 regress/lib/libc/siginfo/sigsegv/sigsegv.c |  4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 1b45b9753364 -r b1168509cced regress/lib/libc/siginfo/sigchld/sigchld.c
--- a/regress/lib/libc/siginfo/sigchld/sigchld.c        Sun Oct 12 17:08:08 2003 +0000
+++ b/regress/lib/libc/siginfo/sigchld/sigchld.c        Sun Oct 12 17:13:46 2003 +0000
@@ -76,7 +76,7 @@
        switch ((child = fork())) {
        case 0:
                sleep(1);
-               *(long *)0x5a5a5a5a = 0;
+               *(long *)0 = 0;
                break;
        case -1:
                err(1, "fork");
diff -r 1b45b9753364 -r b1168509cced regress/lib/libc/siginfo/sigsegv/sigsegv.c
--- a/regress/lib/libc/siginfo/sigsegv/sigsegv.c        Sun Oct 12 17:08:08 2003 +0000
+++ b/regress/lib/libc/siginfo/sigsegv/sigsegv.c        Sun Oct 12 17:13:46 2003 +0000
@@ -36,7 +36,7 @@
        assert(info->si_signo == SIGSEGV);
        assert(info->si_errno == 0);
        assert(info->si_code == SEGV_MAPERR);
-       assert(info->si_addr == (void *)0x5a5a5a5a);
+       assert(info->si_addr == (void *)0);
        exit(0);
 }
 
@@ -48,6 +48,6 @@
        sa.sa_sigaction = sigsegv;
        sigemptyset(&sa.sa_mask);
        sigaction(SIGSEGV, &sa, NULL);
-       *(long *)0x5a5a5a5a = 0;
+       *(long *)0 = 0;
        return 0;
 }



Home | Main Index | Thread Index | Old Index