Date: Thu, 24 Jun 1999 13:00:07 +1000 (EST) From: andrew@ugh.net.au To: FreeBSD-gnats-submit@freebsd.org Subject: bin/12374: errlst.c is out of sync with errno.h Message-ID: <199906240300.NAA40980@css.tuu.utas.edu.au>
index | next in thread | raw e-mail
>Number: 12374
>Category: bin
>Synopsis: errlst.c is out of sync with errno.h
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jun 23 20:10:00 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator: Andrew
>Release: FreeBSD 3.2-STABLE i386
>Organization:
UgH!
>Environment:
3.2-STABLE
>Description:
errno.h defines errors up to 86 but errlst.c stops at 79. Consequently
strerror(3) can return messages like:
Unknown error: 85
rather than:
Operation Cancelled
This is usually seen when a program dies by calling err(3)
>How-To-Repeat:
The simple:
#include <errno.h>
#include <string.h>
#include <stdio.h>
int main() {
printf("%s\n",strerror(ECANCELED));
return(0);
}
Or the (slightly) more useful:
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
void usage() {
fprintf(stderr, "usage: strerror max_errno\n");
exit(EX_USAGE);
}
int main(int argc, char *argv[]) {
int i;
if (argc != 2) {
usage();
}
for (i = 0; i <= atol(argv[argc - 1]); ++i) {
printf("%d: %s\n", i, strerror(i));
}
return(EX_OK);
}
>Fix:
--- errlst.c.orig Wed Jun 23 14:14:31 1999
+++ errlst.c Thu Jun 24 12:57:07 1999
@@ -136,6 +136,13 @@
"No locks available", /* 77 - ENOLCK */
"Function not implemented", /* 78 - ENOSYS */
"Inappropriate file type or format", /* 79 - EFTYPE */
+ "Authentication error", /* 80 - EAUTH */
+ "Need authenticator", /* 81 - ENEEDAUTH */
+ "Identifier removed", /* 82 - EIDRM */
+ "No message of desired type", /* 83 - ENOMSG */
+ "Value to large to be stored in data type", /* 84 - EOVERFLOW */
+ "Operation canceled", /* 85 - ECANCELED */
+ "Illegal byte sequence", /* 86 - EILSEQ */
};
int errno;
const int sys_nerr = sizeof(sys_errlist) / sizeof(sys_errlist[0]);
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199906240300.NAA40980>
