[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Heimdal error number goofiness



Chris Chiappa <griffon+heimdal-discuss@snurgle.org> writes:
> > > 2001-06-18T20:52:04 Failed to open database: Unknown error 4294936306
> > > <griffon>lumberjack-pts/4[261]~$ perl -e 'printf "%d", 4294936306;'
> > > -30990
> > > which I'm guessing is this:
> > > /usr/include/db.h:#define       DB_OLD_VERSION          (-30990)/*
> > > Out-of-date version. */
> > Aha, I assume you linked against a different version of libdb?
> > This was with db2, wasn't it?  I think what's happening is that
> > strerror is returning that string for you.
> Right.  Well, the old version was linked against db2 and the new one against
> db3.  So, it's not really a Heimdal error per sae, but even ignoring the
> lack of error message, the signed/unsigned issue is disconcerting.

I agree.  I wouldn't expect heimdal to be to handle db-files that
libdb is not able to, but it should try to give the most useful error
message possible. :-)

This patch might be able to help to avoid the signed-unsigned
problem.  I'm not sure on how we would be able to get better strings
from the db errors, I would need to look at libdb for that.

/assar

Index: com_err.c
===================================================================
RCS file: /afs/pdc.kth.se/src/packages/kth-krb/SourceRepository/lib/com_err/com_err.c,v
retrieving revision 1.17
diff -u -w -u -w -r1.17 com_err.c
--- com_err.c	2001/05/11 20:02:34	1.17
+++ com_err.c	2001/06/19 12:07:49
@@ -49,8 +49,12 @@
 {
     static char msg[128];
     const char *p = com_right(_et_list, code);
-    if (p == NULL)
+    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;