From e99525f9706900417f37721e601d2b414d41bfee Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Tue, 16 Oct 2007 01:26:41 -0700 Subject: uml: console subsystem tidying This does a lot of cleanup on the UML console system. This patch should be entirely non-functional. The tidying is as follows: header cleanups - the includes should be closer to minimal and complete all printks now have a severity lots of style fixes fd_close is restructured a little in order to reduce the nesting some functions were calling the os_* wrappers when they can call libc directly port_accept had a unnecessary variable it also tested a pid unecessarily before killing it some functions were made static xterm_free is gone, as it was identical to generic_free Signed-off-by: Jeff Dike Cc: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/drivers/pty.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'arch/um/drivers/pty.c') diff --git a/arch/um/drivers/pty.c b/arch/um/drivers/pty.c index 1e3fd61..4123fe1 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, if (data->raw) { CATCH_EINTR(err = tcgetattr(fd, &data->tt)); if (err) - return err; + goto out_close; err = raw(fd); if (err) - return err; + goto out_close; } dev = ptsname(fd); @@ -71,6 +71,10 @@ static int pts_open(int input, int output, int primary, void *d, (*data->announce)(dev, data->dev); return fd; + +out_close: + close(fd); + return err; } static int getmaster(char *line) @@ -119,10 +123,12 @@ static int pty_open(int input, int output, int primary, void *d, if (fd < 0) return fd; - if(data->raw){ + if (data->raw) { err = raw(fd); - if (err) + if (err) { + close(fd); return err; + } } if (data->announce) -- cgit v1.1