summaryrefslogtreecommitdiff
path: root/gdb/inflow.c
diff options
context:
space:
mode:
authorAlexandra Hájková <ahajkova@redhat.com>2021-05-11 09:47:42 +0200
committerAlexandra Hájková <ahajkova@redhat.com>2021-05-19 10:05:19 +0200
commitb534617fd56d260d8d6c6c40124390ce72af476a (patch)
tree769bb0b91f834cf5f8f9dcf4851ca389b989243c /gdb/inflow.c
parent1b3892bedc7674dfd86b1b0285951271cd82de63 (diff)
downloadbinutils-gdb-b534617fd56d260d8d6c6c40124390ce72af476a.tar.gz
inflow.c: Do not leak tty.
In a case open() returns 0 tty might be leaked. While 0 should be stdin (and therefore is an unlikely return value from open()), it's still the case that the test should be for non-negative return values from open(). gdb/ChangeLog: 2021-05-11 Alexandra Hájková <ahajkova@redhat.com> * inflow.c (new_tty): Do not leak tty.
Diffstat (limited to 'gdb/inflow.c')
-rw-r--r--gdb/inflow.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 994c73e40ee..d241540c4cd 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -808,7 +808,7 @@ new_tty (void)
systems (SVR4 for example), this may cause a SIGTTOU, so temporarily
ignore SIGTTOU. */
tty = open ("/dev/tty", O_RDWR);
- if (tty > 0)
+ if (tty >= 0)
{
scoped_ignore_sigttou ignore_sigttou;