aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/umid.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/os-Linux/umid.c')
-rw-r--r--arch/um/os-Linux/umid.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c
index 198e59163288..34bfc1bb9e38 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)
120 120
121 dead = 0; 121 dead = 0;
122 fd = open(file, O_RDONLY); 122 fd = open(file, O_RDONLY);
123 if(fd < 0){ 123 if(fd < 0) {
124 fd = -errno;
124 if(fd != -ENOENT){ 125 if(fd != -ENOENT){
125 printk("not_dead_yet : couldn't open pid file '%s', " 126 printk("not_dead_yet : couldn't open pid file '%s', "
126 "err = %d\n", file, -fd); 127 "err = %d\n", file, -fd);
@@ -130,9 +131,13 @@ static int not_dead_yet(char *dir)
130 131
131 err = 0; 132 err = 0;
132 n = read(fd, pid, sizeof(pid)); 133 n = read(fd, pid, sizeof(pid));
133 if(n <= 0){ 134 if(n < 0){
135 printk("not_dead_yet : couldn't read pid file '%s', "
136 "err = %d\n", file, errno);
137 goto out_close;
138 } else if(n == 0){
134 printk("not_dead_yet : couldn't read pid file '%s', " 139 printk("not_dead_yet : couldn't read pid file '%s', "
135 "err = %d\n", file, -n); 140 "0-byte read\n", file);
136 goto out_close; 141 goto out_close;
137 } 142 }
138 143
@@ -155,9 +160,9 @@ static int not_dead_yet(char *dir)
155 160
156 return err; 161 return err;
157 162
158 out_close: 163out_close:
159 close(fd); 164 close(fd);
160 out: 165out:
161 return 0; 166 return 0;
162} 167}
163 168