source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Prefer warn(3) over perror(3) at the few places where it was
Date: Fri, 8 Jan 2016 10:03:25 -0500 (EST)	[thread overview]
Message-ID: <9703605628796526776.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
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).

Modified Files:
--------------
    mdocml:
        mandocdb.c
        mansearch.c

Revision Data
-------------
Index: mansearch.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mansearch.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -Lmansearch.c -Lmansearch.c -u -p -r1.63 -r1.64
--- mansearch.c
+++ mansearch.c
@@ -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;
Index: mandocdb.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandocdb.c,v
retrieving revision 1.213
retrieving revision 1.214
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.213 -r1.214
--- mandocdb.c
+++ mandocdb.c
@@ -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;
 				}
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2016-01-08 15:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9703605628796526776.enqueue@fantadrom.bsd.lv \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).