Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2020-05-28 22:32:12 +0300
committerBryan Drewery <bryan@shatow.net>2021-09-03 01:54:42 +0300
commitb2cdcb6c842f5d4e0be6060a51c079e78941471f (patch)
tree6025638d18cf13aa8530c33d262f933b7e50f012 /src
parent9fac1437209b5534e8f7cb3858f81f2676c7294b (diff)
locked_mkdir: Avoid trashing SIGALRM handler on early cleanup
Conflicts: src/libexec/poudriere/locked_mkdir/locked_mkdir.c
Diffstat (limited to 'src')
-rw-r--r--src/libexec/poudriere/locked_mkdir/locked_mkdir.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libexec/poudriere/locked_mkdir/locked_mkdir.c b/src/libexec/poudriere/locked_mkdir/locked_mkdir.c
index c57995af..cad2f8d0 100644
--- a/src/libexec/poudriere/locked_mkdir/locked_mkdir.c
+++ b/src/libexec/poudriere/locked_mkdir/locked_mkdir.c
@@ -70,6 +70,9 @@
static int dirfd = -1;
static int lockfd = -1;
static volatile sig_atomic_t timed_out;
+#ifdef SHELL
+static int did_sigalrm;
+#endif
static struct sigaction oact;
#ifdef SHELL
static struct sigdata oinfo;
@@ -121,7 +124,8 @@ cleanup(void)
lockfd = -1;
}
#ifdef SHELL
- sigaction(SIGALRM, &oact, NULL);
+ if (did_sigalrm == 1)
+ sigaction(SIGALRM, &oact, NULL);
trap_pop(SIGINFO, &oinfo);
errno = serrno;
#endif
@@ -283,6 +287,7 @@ main(int argc, char **argv)
dirfd = -1;
lockfd = -1;
timed_out = 0;
+ did_sigalrm = 0;
#endif
lockdirfd = -1;
lockpid = -1;
@@ -324,6 +329,9 @@ main(int argc, char **argv)
act.sa_handler = sig_timeout;
sigemptyset(&act.sa_mask);
act.sa_flags = 0; /* Note that we do not set SA_RESTART. */
+#ifdef SHELL
+ did_sigalrm = 1;
+#endif
sigaction(SIGALRM, &act, &oact);
alarm(waitsec);