diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2006-04-11 05:53:38 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-11 13:18:36 (GMT) |
commit | d84a19ce52a7b01dc7318ea3a8223dfe44cccb6f (patch) | |
tree | a3ad05cee1888b44605ec9b1e02f2f0a8b31035f /arch | |
parent | b1c332c9e813cbee6ca77c3a66ee4d312eb96770 (diff) | |
download | linux-fsl-qoriq-d84a19ce52a7b01dc7318ea3a8223dfe44cccb6f.tar.xz |
[PATCH] uml: fix failure path after conversion
Little fix for error paths in this code.
- Some bug come from conversion to os-Linux (open() doesn't follow the
kernel -errno return convention, while the old code called os_open_file()
which followed it). This caused the wrong return code to be printed.
- Then be more precise about what happened and do some whitespace fixes.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/um/os-Linux/umid.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c index 198e591..34bfc1b 100644 --- a/arch/um/os-Linux/umid.c +++ b/arch/um/os-Linux/umid.c @@ -120,7 +120,8 @@ static int not_dead_yet(char *dir) dead = 0; fd = open(file, O_RDONLY); - if(fd < 0){ + if(fd < 0) { + fd = -errno; if(fd != -ENOENT){ printk("not_dead_yet : couldn't open pid file '%s', " "err = %d\n", file, -fd); @@ -130,9 +131,13 @@ static int not_dead_yet(char *dir) err = 0; n = read(fd, pid, sizeof(pid)); - if(n <= 0){ + if(n < 0){ + printk("not_dead_yet : couldn't read pid file '%s', " + "err = %d\n", file, errno); + goto out_close; + } else if(n == 0){ printk("not_dead_yet : couldn't read pid file '%s', " - "err = %d\n", file, -n); + "0-byte read\n", file); goto out_close; } @@ -155,9 +160,9 @@ static int not_dead_yet(char *dir) return err; - out_close: +out_close: close(fd); - out: +out: return 0; } |