summaryrefslogtreecommitdiffstats
path: root/sbin/unwind/unwind.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/unwind/unwind.c')
-rw-r--r--sbin/unwind/unwind.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sbin/unwind/unwind.c b/sbin/unwind/unwind.c
index 74b8c6ca37e..65da1475953 100644
--- a/sbin/unwind/unwind.c
+++ b/sbin/unwind/unwind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwind.c,v 1.21 2019/03/31 00:57:06 tedu Exp $ */
+/* $OpenBSD: unwind.c,v 1.22 2019/03/31 03:36:18 yasuoka Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -372,7 +372,10 @@ start_child(int p, char *argv0, int fd, int debug, int verbose)
return (pid);
}
- if (dup2(fd, 3) == -1)
+ if (fd != 3) {
+ if (dup2(fd, 3) == -1)
+ fatal("cannot setup imsg fd");
+ } else if (fcntl(fd, F_SETFD, 0) == -1)
fatal("cannot setup imsg fd");
argv[argc++] = argv0;