diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2023-03-31 00:44:29 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2023-03-31 15:06:19 +1100 |
commit | 0eb8131e4a53b33a8fc9b9ab694e6b6778b87ade (patch) | |
tree | f14c694d195b0f12a8f55d812d479dc45ab440ee | |
parent | 7174ba6f8a431ca4257767a260fc50e204068242 (diff) | |
download | openssh-git-0eb8131e4a53b33a8fc9b9ab694e6b6778b87ade.tar.gz |
upstream: 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.
OpenBSD-Commit-ID: 4a95f3f7330394dffee5c749d52713cbf3b54846
-rw-r--r-- | monitor_wrap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c index 27517116..3533cf06 100644 --- a/monitor_wrap.c +++ b/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> @@ -575,7 +575,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; } |