Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev In kloader_open print errno if namei or vn_open fail.



details:   https://anonhg.NetBSD.org/src/rev/6fdd63281263
branches:  trunk
changeset: 586794:6fdd63281263
user:      uwe <uwe%NetBSD.org@localhost>
date:      Mon Jan 02 20:51:09 2006 +0000

description:
In kloader_open print errno if namei or vn_open fail.
Use consistent style for error messages.
While here, return NULL instead on 0 on error.

diffstat:

 sys/dev/kloader.c |  19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diffs (45 lines):

diff -r a286d672a42c -r 6fdd63281263 sys/dev/kloader.c
--- a/sys/dev/kloader.c Mon Jan 02 20:18:59 2006 +0000
+++ b/sys/dev/kloader.c Mon Jan 02 20:51:09 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kloader.c,v 1.7 2005/12/11 12:20:53 christos Exp $     */
+/*     $NetBSD: kloader.c,v 1.8 2006/01/02 20:51:09 uwe Exp $  */
 
 /*-
  * Copyright (c) 2001, 2002, 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kloader.c,v 1.7 2005/12/11 12:20:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kloader.c,v 1.8 2006/01/02 20:51:09 uwe Exp $");
 
 #include "debug_kloader.h"
 
@@ -598,17 +598,20 @@
 {
        struct lwp *l = KLOADER_LWP;
        struct nameidata nid;
+       int error;
 
        NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, l);
 
-       if (namei(&nid) != 0) {
-               PRINTF("namei failed (%s)\n", filename);
-               return (0);
+       error = namei(&nid);
+       if (error != 0) {
+               PRINTF("%s: namei failed, errno=%d\n", filename, error);
+               return (NULL);
        }
 
-       if (vn_open(&nid, FREAD, 0) != 0) {
-               PRINTF("%s open failed\n", filename);
-               return (0);
+       error = vn_open(&nid, FREAD, 0);
+       if (error != 0) {
+               PRINTF("%s: open failed, errno=%d\n", filename, error);
+               return (NULL);
        }
 
        return (nid.ni_vp);



Home | Main Index | Thread Index | Old Index