Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib fix error messages
details: https://anonhg.NetBSD.org/src/rev/751d1937d1a8
branches: trunk
changeset: 338922:751d1937d1a8
user: christos <christos%NetBSD.org@localhost>
date: Wed Jun 17 00:15:26 2015 +0000
description:
fix error messages
diffstat:
lib/libc/yp/yperr_string.c | 6 +++---
lib/libcrypt/crypt.c | 14 ++++++++------
lib/libpuffs/puffs.c | 26 ++++++++++++--------------
lib/libukfs/ukfs.c | 12 ++++++------
4 files changed, 29 insertions(+), 29 deletions(-)
diffs (198 lines):
diff -r 6c02ae2f799b -r 751d1937d1a8 lib/libc/yp/yperr_string.c
--- a/lib/libc/yp/yperr_string.c Wed Jun 17 00:03:42 2015 +0000
+++ b/lib/libc/yp/yperr_string.c Wed Jun 17 00:15:26 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: yperr_string.c,v 1.8 2012/06/25 22:32:46 abs Exp $ */
+/* $NetBSD: yperr_string.c,v 1.9 2015/06/17 00:15:26 christos Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt%fsa.ca@localhost>
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: yperr_string.c,v 1.8 2012/06/25 22:32:46 abs Exp $");
+__RCSID("$NetBSD: yperr_string.c,v 1.9 2015/06/17 00:15:26 christos Exp $");
#endif
#include "namespace.h"
@@ -85,6 +85,6 @@
case YPERR_BUSY:
return __UNCONST("Database is busy");
}
- (void) snprintf(err, sizeof(err), "YP unknown error %d\n", incode);
+ (void) snprintf(err, sizeof(err), "YP unknown error %d", incode);
return err;
}
diff -r 6c02ae2f799b -r 751d1937d1a8 lib/libcrypt/crypt.c
--- a/lib/libcrypt/crypt.c Wed Jun 17 00:03:42 2015 +0000
+++ b/lib/libcrypt/crypt.c Wed Jun 17 00:15:26 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: crypt.c,v 1.33 2011/12/28 03:13:09 christos Exp $ */
+/* $NetBSD: crypt.c,v 1.34 2015/06/17 00:15:26 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)crypt.c 8.1.1.1 (Berkeley) 8/18/93";
#else
-__RCSID("$NetBSD: crypt.c,v 1.33 2011/12/28 03:13:09 christos Exp $");
+__RCSID("$NetBSD: crypt.c,v 1.34 2015/06/17 00:15:26 christos Exp $");
#endif
#endif /* not lint */
@@ -1013,10 +1013,12 @@
int
main(int argc, char *argv[])
{
- if (argc < 2)
- errx(1, "Usage: %s password [salt]\n", argv[0]);
+ if (argc < 2) {
+ fprintf(stderr, "Usage: %s password [salt]\n", getprogname());
+ return EXIT_FAILURE;
+ }
- printf("%s\n", crypt(argv[1], (argc > 2) ? argv[2] : argv[1]));
- exit(0);
+ printf("%s\n", crypt(argv[1], (argc > 2) ? argv[2] : argv[1]));
+ return EXIT_SUCCESS;
}
#endif
diff -r 6c02ae2f799b -r 751d1937d1a8 lib/libpuffs/puffs.c
--- a/lib/libpuffs/puffs.c Wed Jun 17 00:03:42 2015 +0000
+++ b/lib/libpuffs/puffs.c Wed Jun 17 00:15:26 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs.c,v 1.119 2014/12/22 08:16:21 manu Exp $ */
+/* $NetBSD: puffs.c,v 1.120 2015/06/17 00:15:26 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.119 2014/12/22 08:16:21 manu Exp $");
+__RCSID("$NetBSD: puffs.c,v 1.120 2015/06/17 00:15:26 christos Exp $");
#endif /* !lint */
#include <sys/param.h>
@@ -134,7 +134,7 @@
int error, const char *str, puffs_cookie_t cookie)
{
- fprintf(stderr, "abort: type %d, error %d, cookie %p (%s)\n",
+ warnx("abort: type %d, error %d, cookie %p (%s)",
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)\n",
+ syslog(LOG_WARNING, "kernel: type %d, error %d, cookie %p (%s)",
type, error, cookie, str);
}
@@ -213,8 +213,8 @@
minsize = 4*psize;
if (ss < (size_t)minsize || ss == PUFFS_STACKSIZE_MIN) {
if (ss != PUFFS_STACKSIZE_MIN)
- fprintf(stderr, "puffs_setstacksize: adjusting "
- "stacksize to minimum %ld\n", minsize);
+ warnx("%s: adjusting " "stacksize to minimum %ld",
+ __func__, minsize);
ss = 4*psize;
}
@@ -228,8 +228,8 @@
}
if (bonus > 1) {
stackshift++;
- fprintf(stderr, "puffs_setstacksize: using next power of two: "
- "%d\n", 1<<stackshift);
+ warnx("%s: using next power of two: %d", __func__,
+ 1 << stackshift);
}
pu->pu_cc_stackshift = stackshift;
@@ -270,8 +270,7 @@
struct puffs_kargs *pargs = pu->pu_kargp;
if (puffs_getstate(pu) != PUFFS_STATE_BEFOREMOUNT) {
- warnx("puffs_setrootinfo: call has effect only "
- "before mount\n");
+ warnx("%s: call has effect only before mount", __func__);
return;
}
@@ -318,8 +317,7 @@
{
if (puffs_getstate(pu) != PUFFS_STATE_BEFOREMOUNT)
- warnx("puffs_setmaxreqlen: call has effect only "
- "before mount\n");
+ warnx("%s: call has effect only before mount", __func__);
pu->pu_kargp->pa_maxmsglen = reqlen;
}
@@ -329,7 +327,7 @@
{
if (puffs_getstate(pu) != PUFFS_STATE_BEFOREMOUNT)
- warnx("puffs_setfhsize: call has effect only before mount\n");
+ warnx("%s: call has effect only before mount", __func__);
pu->pu_kargp->pa_fhsize = fhsize;
pu->pu_kargp->pa_fhflags = flags;
@@ -340,7 +338,7 @@
{
if (puffs_getstate(pu) != PUFFS_STATE_BEFOREMOUNT)
- warnx("puffs_setfhsize: call has effect only before mount\n");
+ warnx("%s: call has effect only before mount", __func__);
pu->pu_kargp->pa_nhashbuckets = nhash;
}
diff -r 6c02ae2f799b -r 751d1937d1a8 lib/libukfs/ukfs.c
--- a/lib/libukfs/ukfs.c Wed Jun 17 00:03:42 2015 +0000
+++ b/lib/libukfs/ukfs.c Wed Jun 17 00:15:26 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ukfs.c,v 1.57 2011/02/22 15:42:15 pooka Exp $ */
+/* $NetBSD: ukfs.c,v 1.58 2015/06/17 00:15:26 christos Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Antti Kantee. All Rights Reserved.
@@ -182,9 +182,9 @@
int rv;
if (version != UKFS_VERSION) {
- printf("incompatible ukfs version, %d vs. %d\n",
+ errno = EPROGMISMATCH;
+ warn("incompatible ukfs version, %d vs. %d",
version, UKFS_VERSION);
- errno = EPROGMISMATCH;
return -1;
}
@@ -213,8 +213,8 @@
int devfd = -1;
if ((p = strstr(devpath, UKFS_PARTITION_SCANMAGIC)) != NULL) {
- fprintf(stderr, "ukfs: %%PART is deprecated. use "
- "%%DISKLABEL instead\n");
+ warnx("ukfs: %%PART is deprecated. use "
+ "%%DISKLABEL instead");
errno = ENODEV;
return -1;
}
@@ -1152,7 +1152,7 @@
const char *dlmsg = dlerror();
if (strstr(dlmsg, "Undefined symbol"))
return 0;
- warnx("dlopen %s failed: %s\n", fname, dlmsg);
+ warnx("dlopen %s failed: %s", fname, dlmsg);
/* XXXerrno */
return -1;
}
Home |
Main Index |
Thread Index |
Old Index