diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2023-03-31 00:44:30 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2023-03-31 00:44:30 +0000 |
commit | c5398c67be308e476fc348af12b089e063366a3a (patch) | |
tree | 08a8fa10487eccb5b823678501170cbbe50f5741 | |
parent | 131324254a4242904ab44228f2167db8a64ef1bf (diff) |
Check fd against >=0 instead of >0 in error path. The dup could
in theory return fd 0 although currently it doesn't in practice.
From Dmitry Belyavskiy vi github PR#238.
-rw-r--r-- | usr.bin/ssh/monitor_wrap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/ssh/monitor_wrap.c b/usr.bin/ssh/monitor_wrap.c index 4dca66bf641..301b2161022 100644 --- a/usr.bin/ssh/monitor_wrap.c +++ b/usr.bin/ssh/monitor_wrap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor_wrap.c,v 1.127 2023/03/30 00:49:37 dtucker Exp $ */ +/* $OpenBSD: monitor_wrap.c,v 1.128 2023/03/31 00:44:29 dtucker Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * Copyright 2002 Markus Friedl <markus@openbsd.org> @@ -552,7 +552,7 @@ mm_pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, size_t namebuflen) if ((tmp1 = dup(pmonitor->m_recvfd)) == -1 || (tmp2 = dup(pmonitor->m_recvfd)) == -1) { error_f("cannot allocate fds for pty"); - if (tmp1 > 0) + if (tmp1 >= 0) close(tmp1); return 0; } |