From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92] helo=mail.sourceforge.net) by sc8-sf-list1.sourceforge.net with esmtp (Exim 4.30) id 1FRs0l-0003Gy-M7 for user-mode-linux-devel@lists.sourceforge.net; Fri, 07 Apr 2006 07:32:32 -0700 Received: from [151.97.230.9] (helo=ssc.unict.it) by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.44) id 1FRs0i-00079o-41 for user-mode-linux-devel@lists.sourceforge.net; Fri, 07 Apr 2006 07:32:31 -0700 From: "Paolo 'Blaisorblade' Giarrusso" Message-Id: <20060407143119.19201.41577.stgit@zion.home.lan> In-Reply-To: <20060407142709.19201.99196.stgit@zion.home.lan> References: <20060407142709.19201.99196.stgit@zion.home.lan> Subject: [uml-devel] [PATCH 13/17] uml: fix failure path after conversion Sender: user-mode-linux-devel-admin@lists.sourceforge.net Errors-To: user-mode-linux-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Id: The user-mode Linux development list List-Post: List-Help: List-Subscribe: , List-Archive: Date: Fri, 07 Apr 2006 16:31:20 +0200 To: Andrew Morton Cc: Jeff Dike , linux-kernel@vger.kernel.org, user-mode-linux-devel@lists.sourceforge.net From: Paolo 'Blaisorblade' Giarrusso 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 --- 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; } ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel