(error_message): do not call strerror with a negative error
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10865 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		| @@ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan | ||||
|  * Copyright (c) 1997 - 2002 Kungliga Tekniska H<>gskolan | ||||
|  * (Royal Institute of Technology, Stockholm, Sweden).  | ||||
|  * All rights reserved.  | ||||
|  * | ||||
| @@ -49,8 +49,12 @@ error_message (long code) | ||||
| { | ||||
|     static char msg[128]; | ||||
|     const char *p = com_right(_et_list, code); | ||||
|     if (p == NULL) | ||||
| 	p = strerror(code); | ||||
|     if (p == NULL) { | ||||
| 	if (code < 0) | ||||
| 	    sprintf(msg, "Unknown error %ld", code); | ||||
| 	else | ||||
| 	    p = strerror(code); | ||||
|     } | ||||
|     if (p != NULL && *p != '\0') { | ||||
| 	strncpy(msg, p, sizeof(msg) - 1); | ||||
| 	msg[sizeof(msg) - 1] = 0; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Assar Westerlund
					Assar Westerlund