summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2001-06-20 03:45:17 +0000
committerKen Raeburn <raeburn@mit.edu>2001-06-20 03:45:17 +0000
commit6a0a6f1757224a2b2a1e9e973f92de0fcb542f90 (patch)
treedfbf26c5fa93dd9ecd4af435658b03b20a0c36e7 /src
parent44a4b461d1bc6c42448573be4e29fce7619ee0d9 (diff)
downloadkrb5-6a0a6f1757224a2b2a1e9e973f92de0fcb542f90.tar.gz
krb5-6a0a6f1757224a2b2a1e9e973f92de0fcb542f90.tar.xz
krb5-6a0a6f1757224a2b2a1e9e973f92de0fcb542f90.zip
handle irix high-numbered error codes
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13392 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/util/et/ChangeLog8
-rw-r--r--src/util/et/error_message.c22
-rw-r--r--src/util/et/test_et.c1
3 files changed, 24 insertions, 7 deletions
diff --git a/src/util/et/ChangeLog b/src/util/et/ChangeLog
index d27c224def..94a4246994 100644
--- a/src/util/et/ChangeLog
+++ b/src/util/et/ChangeLog
@@ -1,3 +1,11 @@
+2001-06-19 Ken Raeburn <raeburn@mit.edu>
+
+ * error_message.c (error_message): Handle some Irix error codes
+ ranging up above sys_nerr, and above 256.
+
+ * test_et.c (main): Test one of the high-numbered Irix system
+ error codes.
+
2001-03-11 Ezra Peisach <epeisach@mit.edu>
* com_err.h: For struct error_table, change the base from an
diff --git a/src/util/et/error_message.c b/src/util/et/error_message.c
index 50f313cbcd..4870e88f4e 100644
--- a/src/util/et/error_message.c
+++ b/src/util/et/error_message.c
@@ -68,6 +68,12 @@ static struct et_list etl[PREALLOCATE_ETL];
static int etl_used = 0;
#endif
+#ifndef DEBUG_TABLE_LIST
+#define dprintf(X)
+#else
+#define dprintf(X) printf X
+#endif
+
KRB5_DLLIMP const char FAR * KRB5_CALLCONV
error_message(long code)
/*@modifies internalState@*/
@@ -86,14 +92,15 @@ error_message(long code)
offset = l_offset;
table_num = ((unsigned long)code - l_offset) & ERRCODE_MAX;
if (table_num == 0) {
+ system_error_code:
if (code == 0)
goto oops;
/* This could trip if int is 16 bits. */
- if ((unsigned long)(int)offset != offset)
+ if ((unsigned long)(int)code != code)
abort ();
#ifdef HAVE_STRERROR
- cp = strerror((int) offset);
+ cp = strerror((int) code);
if (cp)
return cp;
goto oops;
@@ -108,11 +115,12 @@ error_message(long code)
#endif /* HAVE_SYS_ERRLIST */
#endif /* HAVE_STRERROR */
}
-
-#ifndef DEBUG_TABLE_LIST
-#define dprintf(X)
-#else
-#define dprintf(X) printf X
+#ifdef __sgi
+ /* Irix 6.5 uses a much bigger table than other UNIX systems
+ I've looked at, but the table is sparse. The sparse
+ entries start around 500, but sys_nerr is only 152. */
+ if (code > 0 && code <= 1600)
+ goto system_error_code;
#endif
dprintf (("scanning static list for %x\n", table_num));
diff --git a/src/util/et/test_et.c b/src/util/et/test_et.c
index 6b6b5a945e..41ac394d59 100644
--- a/src/util/et/test_et.c
+++ b/src/util/et/test_et.c
@@ -17,6 +17,7 @@ int main()
printf("Msg TGT-expired is '%s'\n", error_message(KRB_MK_AP_TGTEXP));
printf("Msg EPERM is '%s'\n", error_message(EPERM));
printf("Msg FOO_ERR is '%s'\n", error_message(FOO_ERR));
+ printf("Msg 1002 is '%s'\n", error_message (1002));
#ifdef HAVE_SYS_ERRLIST
printf("Msg {sys_nerr-1} is '%s'\n", error_message(sys_nerr-1));
printf("Msg {sys_nerr} is '%s'\n", error_message(sys_nerr));