* error_message.c (error_message): Mask error code with
authorEzra Peisach <epeisach@mit.edu>
Tue, 22 Jul 1997 00:29:16 +0000 (00:29 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 22 Jul 1997 00:29:16 +0000 (00:29 +0000)
ERRCODE_MASK to handle case where 32bit ints are zero
filled in the gssapi layer.

* error_table.h: Define ERRCODE_MAX, the maximum allowed error
code (32bits).

I am taking the draconian outlook that the com_err library was always
intending to define the error as a 32 bit value. I taken this approach
instead of making the errcode_t machine specific as the com_er
generated header files would then need be machine specific as
well. (error codes are declared as say -4353L explicitly).

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10122 dc483132-0cff-0310-8789-dd5450dbe970

src/util/et/ChangeLog
src/util/et/error_message.c
src/util/et/error_table.h

index e886e3a889486229df691b5909c40e2cc52ca8ae..f6bdc7d66c33f4286226af330d011b50bb1658d1 100644 (file)
@@ -1,3 +1,12 @@
+Mon Jul 21 12:00:24 1997  Ezra Peisach  <epeisach@mit.edu>
+
+       * error_message.c (error_message): Mask error code with
+               ERRCODE_MASK to handle case where 32bit ints are zero
+               filed in the gssapi layer.
+
+       * error_table.h: Define ERRCODE_MAX, the maximum allowed error
+               code (32bits).  
+
 Tue Mar 18 15:07:40 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
 
        * com_err.h: Add 'extern "C"' for C++ compatibility; also check for
index 81e5088c127815b10a48a1a63aaac33b14466a0e..691df289e0b724938c09e3d07e5ad87035e3a10c 100644 (file)
@@ -61,7 +61,7 @@ KRB5_DLLIMP const char FAR * KRB5_CALLCONV error_message(code)
 
        l_offset = (unsigned long)code & ((1<<ERRCODE_RANGE)-1);
        offset = l_offset;
-       table_num = (unsigned long)code - l_offset;
+       table_num = ((unsigned long)code - l_offset) & ERRCODE_MAX;
        if (!table_num) {
                if (code == 0)
                        goto oops;
@@ -85,7 +85,7 @@ KRB5_DLLIMP const char FAR * KRB5_CALLCONV error_message(code)
 
        et = _et_list;
        while (et) {
-           if (et->table->base == table_num) {
+           if ((et->table->base & ERRCODE_MAX) == table_num) {
                        /* This is the right table */
                        if (et->table->n_msgs <= offset)
                                break;
index a3cc229ac1e4db6d3a6bbdb237e278911eb9aadd..053a521745d0b36475f3880bf0fd73339bb4a6c2 100644 (file)
@@ -22,6 +22,7 @@ extern struct et_list * _et_list;
 
 #define        ERRCODE_RANGE   8       /* # of bits to shift table number */
 #define        BITS_PER_CHAR   6       /* # bits to shift per character in name */
+#define ERRCODE_MAX   0xFFFFFFFF      /* Mask for maximum error table */
 
 extern const char FAR *error_table_name ET_P((unsigned long));
 extern const char FAR *error_table_name_r ET_P((unsigned long, char FAR *));