From acs@css.tuu.utas.edu.au Wed Jun 23 20:00:28 1999
Return-Path: <acs@css.tuu.utas.edu.au>
Received: from css.tuu.utas.edu.au (css.tuu.utas.edu.au [131.217.115.65])
	by hub.freebsd.org (Postfix) with ESMTP id C274714D3A
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 23 Jun 1999 20:00:11 -0700 (PDT)
	(envelope-from acs@css.tuu.utas.edu.au)
Received: (from acs@localhost)
	by css.tuu.utas.edu.au (8.9.3/8.9.3) id NAA40980;
	Thu, 24 Jun 1999 13:00:07 +1000 (EST)
	(envelope-from acs)
Message-Id: <199906240300.NAA40980@css.tuu.utas.edu.au>
Date: Thu, 24 Jun 1999 13:00:07 +1000 (EST)
From: andrew@ugh.net.au
Sender: acs@css.tuu.utas.edu.au
Reply-To: andrew@ugh.net.au
To: FreeBSD-gnats-submit@freebsd.org
Subject: errlst.c is out of sync with errno.h
X-Send-Pr-Version: 3.2

>Number:         12374
>Category:       bin
>Synopsis:       errlst.c is out of sync with errno.h
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    sheldonh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 23 20:10:00 PDT 1999
>Closed-Date:    Thu Jun 24 07:41:08 PDT 1999
>Last-Modified:  Thu Jun 24 07:45:00 PDT 1999
>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:

From: Chris Costello <chris@calldei.com>
To: andrew@ugh.net.au
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/12374: errlst.c is out of sync with errno.h
Date: Wed, 23 Jun 1999 22:19:24 -0500

 On Wed, Jun 23, 1999, andrew@ugh.net.au wrote:
 > 
 > >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:
 
    I've fixed this in -CURRENT; someone should MFC this.
 
 -- 
 Chris Costello                                <chris@calldei.com>
 Netnews is like yelling, "Anyone want to buy a used car?" in a crowded theater.
 
State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Thu Jun 24 07:41:08 PDT 1999 
State-Changed-Why:  
MFC of phk's fix done. Fixed for stable in rev 1.1.1.1.10.1 of 
errlst.c . 


Responsible-Changed-From-To: freebsd-bugs->sheldonh 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Thu Jun 24 07:41:08 PDT 1999 
Responsible-Changed-Why:  
Did the MFC before taking the PR. Sorry. 
>Unformatted:
