diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 01:26:41 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 09:43:04 -0700 |
commit | e99525f9706900417f37721e601d2b414d41bfee (patch) | |
tree | fb407ea65a7c4c8bf457dd2ccab98842570cc62f /arch/um/drivers/pty.c | |
parent | 79f662334fefa2dd3fdf66c44a4d2dca5e378ab4 (diff) | |
download | op-kernel-dev-e99525f9706900417f37721e601d2b414d41bfee.zip op-kernel-dev-e99525f9706900417f37721e601d2b414d41bfee.tar.gz |
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 <jdike@linux.intel.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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 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) |