diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-05-01 15:16:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-05-01 21:17:44 -0400 |
commit | 2ace87b9502d922397cabaf07d73e0b60c480ecf (patch) | |
tree | b354425542c4b2cff20dc20cd65d0e8eeec2c7c4 /arch/um/os-Linux/umid.c | |
parent | 347b3dc2faf34d63a96b41e3244b743cc72a2aa0 (diff) |
[PATCH] uml: error handling fixes
Blairsorblade noticed some confusion between our use of a system
call's return value and errno. This patch fixes a number of related
bugs -
using errno instead of a return value
using a return value instead of errno
forgetting to negate a error return to get a positive error code
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/os-Linux/umid.c')
-rw-r--r-- | arch/um/os-Linux/umid.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c index 34bfc1bb9e38..362db059fe30 100644 --- a/arch/um/os-Linux/umid.c +++ b/arch/um/os-Linux/umid.c | |||
@@ -178,14 +178,14 @@ static void __init create_pid_file(void) | |||
178 | fd = open(file, O_RDWR | O_CREAT | O_EXCL, 0644); | 178 | fd = open(file, O_RDWR | O_CREAT | O_EXCL, 0644); |
179 | if(fd < 0){ | 179 | if(fd < 0){ |
180 | printk("Open of machine pid file \"%s\" failed: %s\n", | 180 | printk("Open of machine pid file \"%s\" failed: %s\n", |
181 | file, strerror(-fd)); | 181 | file, strerror(errno)); |
182 | return; | 182 | return; |
183 | } | 183 | } |
184 | 184 | ||
185 | snprintf(pid, sizeof(pid), "%d\n", getpid()); | 185 | snprintf(pid, sizeof(pid), "%d\n", getpid()); |
186 | n = write(fd, pid, strlen(pid)); | 186 | n = write(fd, pid, strlen(pid)); |
187 | if(n != strlen(pid)) | 187 | if(n != strlen(pid)) |
188 | printk("Write of pid file failed - err = %d\n", -n); | 188 | printk("Write of pid file failed - err = %d\n", errno); |
189 | 189 | ||
190 | close(fd); | 190 | close(fd); |
191 | } | 191 | } |