From c2d0e548871bfed103ed040312a4333026ee10f1 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 8 Jan 2016 15:02:54 +0000 Subject: Prefer warn(3) over perror(3) at the few places where it was used. It is useful to see the program name, and we have err.h compat in place anyway. Suggested by Christos Zoulas (NetBSD). --- mandocdb.c | 8 ++++---- mansearch.c | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mandocdb.c b/mandocdb.c index 6c822efc..93cca9ec 100644 --- a/mandocdb.c +++ b/mandocdb.c @@ -1,4 +1,4 @@ -/* $Id: mandocdb.c,v 1.213 2016/01/08 02:53:13 schwarze Exp $ */ +/* $Id: mandocdb.c,v 1.214 2016/01/08 15:02:54 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011-2016 Ingo Schwarze @@ -341,7 +341,7 @@ mandocdb(int argc, char *argv[]) #if HAVE_PLEDGE if (pledge("stdio rpath wpath cpath fattr flock proc exec", NULL) == -1) { - perror("pledge"); + warn("pledge"); return (int)MANDOCLEVEL_SYSERR; } #endif @@ -422,7 +422,7 @@ mandocdb(int argc, char *argv[]) #if HAVE_PLEDGE if (nodb) { if (pledge("stdio rpath", NULL) == -1) { - perror("pledge"); + warn("pledge"); return (int)MANDOCLEVEL_SYSERR; } } @@ -456,7 +456,7 @@ mandocdb(int argc, char *argv[]) #if HAVE_PLEDGE if (!nodb) { if (pledge("stdio rpath wpath cpath fattr flock", NULL) == -1) { - perror("pledge"); + warn("pledge"); exitcode = (int)MANDOCLEVEL_SYSERR; goto out; } diff --git a/mansearch.c b/mansearch.c index e6e5d997..843326ba 100644 --- a/mansearch.c +++ b/mansearch.c @@ -1,4 +1,4 @@ -/* $Id: mansearch.c,v 1.63 2015/11/26 07:42:11 schwarze Exp $ */ +/* $Id: mansearch.c,v 1.64 2016/01/08 15:02:54 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015 Ingo Schwarze @@ -125,7 +125,7 @@ mansearch_setup(int start) MAP_SHARED | MAP_ANON, -1, 0); if (MAP_FAILED == pagecache) { - perror("mmap"); + warn("mmap"); pagecache = NULL; return (int)MANDOCLEVEL_SYSERR; } @@ -144,7 +144,7 @@ mansearch_setup(int start) } if (-1 == munmap(pagecache, PC_PAGESIZE * PC_NUMPAGES)) { - perror("munmap"); + warn("munmap"); pagecache = NULL; return (int)MANDOCLEVEL_SYSERR; } @@ -226,12 +226,12 @@ mansearch(const struct mansearch *search, warnx("%s: getcwd: %s", paths->paths[i], buf); continue; } else if (chdir(buf) == -1) { - perror(buf); + warn("%s", buf); continue; } } if (chdir(paths->paths[i]) == -1) { - perror(paths->paths[i]); + warn("%s", paths->paths[i]); continue; } chdir_status = 1; @@ -364,7 +364,7 @@ mansearch(const struct mansearch *search, } qsort(*res, cur, sizeof(struct manpage), manpage_compare); if (chdir_status && getcwd_status && chdir(buf) == -1) - perror(buf); + warn("%s", buf); exprfree(e); free(sql); *sz = cur; -- cgit v1.2.3