Date: Mon, 8 Sep 2008 19:58:42 GMT From: Bruce Cran <bruce@cran.org.uk> To: freebsd-gnats-submit@FreeBSD.org Subject: docs/127220: [patch] err(3) suggests using exit values from sysexits(3) but examples don't Message-ID: <200809081958.m88JwgPK080011@www.freebsd.org> Resent-Message-ID: <200809082000.m88K0CBx040055@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 127220 >Category: docs >Synopsis: [patch] err(3) suggests using exit values from sysexits(3) but examples don't >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Mon Sep 08 20:00:11 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Bruce Cran >Release: 7.0-RELEASE-p3 >Organization: >Environment: FreeBSD tau.draftnet 7.0-RELEASE-p3 FreeBSD 7.0-RELEASE-p3 #1: Mon Aug 4 00:11:11 BST 2008 brucec@tau.draftnet:/usr/obj/usr/src/sys/MYKERNEL amd64 >Description: err(3) suggests that exit codes from sysexits(3) be used for the eval parameter, but fails to use them in the examples. >How-To-Repeat: man 3 err >Fix: Patch attached with submission follows: --- /usr/src/lib/libc/gen/err.3 2007-01-09 00:27:53.000000000 +0000 +++ err.3 2008-09-08 20:54:20.000000000 +0100 @@ -178,15 +178,15 @@ Display the current errno information string and exit: .Bd -literal -offset indent if ((p = malloc(size)) == NULL) - err(1, NULL); + err(EX_OSERR, NULL); if ((fd = open(file_name, O_RDONLY, 0)) == -1) - err(1, "%s", file_name); + err(EX_NOINPUT, "%s", file_name); .Ed .Pp Display an error message and exit: .Bd -literal -offset indent if (tm.tm_hour < START_TIME) - errx(1, "too early, wait until %s", start_time_string); + errx(EX_DATAERR, "too early, wait until %s", start_time_string); .Ed .Pp Warn of an error: @@ -195,7 +195,7 @@ warnx("%s: %s: trying the block device", raw_device, strerror(errno)); if ((fd = open(block_device, O_RDONLY, 0)) == -1) - err(1, "%s", block_device); + err(EX_OSFILE, "%s", block_device); .Ed .Pp Warn of an error without using the global variable >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809081958.m88JwgPK080011>