From 814474bfe15660514131f504d3ef71790237268e Mon Sep 17 00:00:00 2001 From: mvs Date: Wed, 1 Dec 2021 10:24:40 +0000 Subject: [PATCH] Make `sun' global variable. It used by threads and could be corrupted when main() thread exited. --- regress/sys/kern/unconacc/unconacc.c | 5 +++-- regress/sys/kern/undgram_conclose/undgram_conclose.c | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/regress/sys/kern/unconacc/unconacc.c b/regress/sys/kern/unconacc/unconacc.c index c687091260f..52ca734e192 100644 --- a/regress/sys/kern/unconacc/unconacc.c +++ b/regress/sys/kern/unconacc/unconacc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unconacc.c,v 1.3 2021/11/29 21:25:09 mvs Exp $ */ +/* $OpenBSD: unconacc.c,v 1.4 2021/12/01 10:24:40 mvs Exp $ */ /* * Copyright (c) 2021 Vitaliy Makkoveev @@ -119,6 +119,8 @@ thr_conn(void *arg) return NULL; } +static struct sockaddr_un sun; + int main(int argc, char *argv[]) { @@ -127,7 +129,6 @@ main(int argc, char *argv[]) .tv_nsec = 0, }; - struct sockaddr_un sun; int s; int mib[2], ncpu; diff --git a/regress/sys/kern/undgram_conclose/undgram_conclose.c b/regress/sys/kern/undgram_conclose/undgram_conclose.c index 678021d5714..8f5415905f1 100644 --- a/regress/sys/kern/undgram_conclose/undgram_conclose.c +++ b/regress/sys/kern/undgram_conclose/undgram_conclose.c @@ -1,4 +1,4 @@ -/* $OpenBSD: undgram_conclose.c,v 1.3 2021/11/29 21:25:09 mvs Exp $ */ +/* $OpenBSD: undgram_conclose.c,v 1.4 2021/12/01 10:24:40 mvs Exp $ */ /* * Copyright (c) 2021 Vitaliy Makkoveev @@ -97,6 +97,8 @@ thr_conn(void *arg) return NULL; } +static struct sockaddr_un sun; + int main(int argc, char *argv[]) { @@ -108,8 +110,6 @@ main(int argc, char *argv[]) int mib[2], ncpu; size_t len; - struct sockaddr_un sun; - pthread_t thr; int error, i; -- 2.20.1