Skip to content

Commit

Permalink
[PATCH] uml: fix failure path after conversion
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paolo 'Blaisorblade' Giarrusso authored and Linus Torvalds committed Apr 11, 2006
1 parent b1c332c commit d84a19c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions arch/um/os-Linux/umid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}

Expand All @@ -155,9 +160,9 @@ static int not_dead_yet(char *dir)

return err;

out_close:
out_close:
close(fd);
out:
out:
return 0;
}

Expand Down

0 comments on commit d84a19c

Please sign in to comment.