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-29 00:09:54 +0300
committerBryan Drewery <bryan@shatow.net>2021-09-03 01:49:32 +0300
commitb062714b0f702ce5deac73fef00153ea3622b10b (patch)
tree5a3afa78fa1f829cc0567c7df32dc44b536dc03e /src
parent7dbac1b9c2eaac175951c343878d26497a94ab2b (diff)
locked_mkdir builtin: Fix possible fd leak.
This fixes the case after the watched pid exits but when the mkdir fails which isn't expected to happen.
Diffstat (limited to 'src')
-rw-r--r--src/libexec/poudriere/locked_mkdir/locked_mkdir.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libexec/poudriere/locked_mkdir/locked_mkdir.c b/src/libexec/poudriere/locked_mkdir/locked_mkdir.c
index 5a82eab1..53fe2ffc 100644
--- a/src/libexec/poudriere/locked_mkdir/locked_mkdir.c
+++ b/src/libexec/poudriere/locked_mkdir/locked_mkdir.c
@@ -434,8 +434,11 @@ retry:
/* This is expected to succeed. */
mkdirat(dirfd, path, S_IRWXU) != 0) {
#ifdef SHELL
+ serrno = errno;
+ close(lockdirfd);
cleanup();
INTON;
+ errno = serrno;
#endif
err(1, "mkdirat: %s", path);
}