diff options
Diffstat (limited to 'arch/um/drivers/pty.c')
-rw-r--r-- | arch/um/drivers/pty.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c index 1e3fd619a837..4123fe1fca98 100644 --- a/arch/um/drivers/pty.c +++ b/arch/um/drivers/pty.c | |||
@@ -56,11 +56,11 @@ static int pts_open(int input, int output, int primary, void *d, | |||
56 | if (data->raw) { | 56 | if (data->raw) { |
57 | CATCH_EINTR(err = tcgetattr(fd, &data->tt)); | 57 | CATCH_EINTR(err = tcgetattr(fd, &data->tt)); |
58 | if (err) | 58 | if (err) |
59 | return err; | 59 | goto out_close; |
60 | 60 | ||
61 | err = raw(fd); | 61 | err = raw(fd); |
62 | if (err) | 62 | if (err) |
63 | return err; | 63 | goto out_close; |
64 | } | 64 | } |
65 | 65 | ||
66 | dev = ptsname(fd); | 66 | dev = ptsname(fd); |
@@ -71,6 +71,10 @@ static int pts_open(int input, int output, int primary, void *d, | |||
71 | (*data->announce)(dev, data->dev); | 71 | (*data->announce)(dev, data->dev); |
72 | 72 | ||
73 | return fd; | 73 | return fd; |
74 | |||
75 | out_close: | ||
76 | close(fd); | ||
77 | return err; | ||
74 | } | 78 | } |
75 | 79 | ||
76 | static int getmaster(char *line) | 80 | static int getmaster(char *line) |
@@ -119,10 +123,12 @@ static int pty_open(int input, int output, int primary, void *d, | |||
119 | if (fd < 0) | 123 | if (fd < 0) |
120 | return fd; | 124 | return fd; |
121 | 125 | ||
122 | if(data->raw){ | 126 | if (data->raw) { |
123 | err = raw(fd); | 127 | err = raw(fd); |
124 | if (err) | 128 | if (err) { |
129 | close(fd); | ||
125 | return err; | 130 | return err; |
131 | } | ||
126 | } | 132 | } |
127 | 133 | ||
128 | if (data->announce) | 134 | if (data->announce) |