Source-Changes-HG archive

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

[src/trunk]: src/lib/libpuffs fix error messages (use __func__, quotes)



details:   https://anonhg.NetBSD.org/src/rev/13290db1123b
branches:  trunk
changeset: 357313:13290db1123b
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Nov 05 15:33:15 2017 +0000

description:
fix error messages (use __func__, quotes)
also differentiate between canonical and non-relative.

diffstat:

 lib/libpuffs/puffs.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (62 lines):

diff -r 13a376edcdce -r 13290db1123b lib/libpuffs/puffs.c
--- a/lib/libpuffs/puffs.c      Sun Nov 05 11:07:32 2017 +0000
+++ b/lib/libpuffs/puffs.c      Sun Nov 05 15:33:15 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs.c,v 1.121 2017/05/31 17:56:00 christos Exp $     */
+/*     $NetBSD: puffs.c,v 1.122 2017/11/05 15:33:15 christos Exp $     */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: puffs.c,v 1.121 2017/05/31 17:56:00 christos Exp $");
+__RCSID("$NetBSD: puffs.c,v 1.122 2017/11/05 15:33:15 christos Exp $");
 #endif /* !lint */
 
 #include <sys/param.h>
@@ -134,7 +134,7 @@
        int error, const char *str, puffs_cookie_t cookie)
 {
 
-       warnx("abort: type %d, error %d, cookie %p (%s)",
+       warnx("%s: type %d, error %d, cookie %p (%s)", __func__,
            type, error, cookie, str);
        abort();
 }
@@ -145,7 +145,7 @@
        int error, const char *str, puffs_cookie_t cookie)
 {
 
-       syslog(LOG_WARNING, "kernel: type %d, error %d, cookie %p (%s)",
+       syslog(LOG_WARNING, "%s: type %d, error %d, cookie %p (%s)", __func__,
            type, error, cookie, str);
 }
 
@@ -583,19 +583,20 @@
                dirlen = strlen(dir);
                if (strncmp(dir, rp, rplen) != 0 ||
                    strspn(dir + rplen, "/") != dirlen - rplen) {
-                       warnx("puffs_mount: \"%s\" is a relative path.", dir);
-                       warnx("puffs_mount: using \"%s\" instead.", rp);
+                       warnx("%s: `%s' is a %s path.", __func__, dir,
+                           dir[0] != '/' ? "relative" : "non canonical");
+                       warnx("%s: using `%s' instead.", __func__, rp);
                }
 
                fd = open(_PATH_PUFFS, O_RDWR);
                if (fd == -1) {
-                       warnx("puffs_mount: cannot open %s", _PATH_PUFFS);
+                       warnx("%s: cannot open `%s'", __func__, _PATH_PUFFS);
                        rv = -1;
                        goto out;
                }
                if (fd <= 2)
-                       warnx("puffs_mount: device fd %d (<= 2), sure this is "
-                           "what you want?", fd);
+                       warnx("%s: device fd %d (<= 2), sure this is "
+                           "what you want?", __func__, fd);
 
                pu->pu_kargp->pa_fd = pu->pu_fd = fd;
                if ((rv = mount(MOUNT_PUFFS, rp, mntflags,



Home | Main Index | Thread Index | Old Index