source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Prefer warn(3) over perror(3) at the few places where it was
@ 2016-01-08 15:03 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2016-01-08 15:03 UTC (permalink / raw)
  To: source

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-08 15:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-08 15:03 mdocml: Prefer warn(3) over perror(3) at the few places where it was schwarze

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).