+/*
+ * $Id: cnid_get.c,v 1.7 2001-09-22 07:12:10 jmarcus Exp $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#ifdef CNID_DB
#include <stdio.h>
#include <string.h>
#include <sys/param.h>
CNID_private *db;
DBT key, data;
cnid_t id;
+ int rc = 0;
if (!(db = CNID) || (len > MAXPATHLEN))
return 0;
key.data = start;
key.size = CNID_DID_LEN + len + 1;
- while (errno = db->db_didname->get(db->db_didname, NULL,
- &key, &data, 0)) {
- if (errno == EAGAIN)
+ while ((rc = db->db_didname->get(db->db_didname, NULL,
+ &key, &data, 0))) {
+ if (rc == DB_LOCK_DEADLOCK)
continue;
- if (errno != DB_NOTFOUND)
- syslog(LOG_ERR, "cnid_get: can't get CNID(%u:%s)", did, name);
+ if (rc != DB_NOTFOUND)
+ syslog(LOG_ERR, "cnid_get: can't get CNID(%u:%s) (%d)", did, name, rc);
return 0;
}
memcpy(&id, data.data, sizeof(id));
return id;
}
+#endif /* CNID_DB */