]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/cnid/cnid_lookup.c
Edmund Lam's compilation patches for non-CNID support
[netatalk.git] / libatalk / cnid / cnid_lookup.c
index 2d0dbe7e9dc50db2862c922acc052e61dc81db4d..61afe246f37c2edad61528d0f205cb10c0065ba1 100644 (file)
@@ -1,11 +1,12 @@
 /*
- * $Id: cnid_lookup.c,v 1.3 2001-08-14 14:00:10 rufustfirefly Exp $
+ * $Id: cnid_lookup.c,v 1.6 2001-08-31 14:58:48 rufustfirefly 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>
@@ -61,9 +62,9 @@ cnid_t cnid_lookup(void *CNID,
      only get a match on one of them, that means a file has moved. */
   key.data = buf; /* dev/ino is the first part of the buffer */
   key.size = CNID_DEVINO_LEN;
-  while (errno = db->db_devino->get(db->db_devino, NULL,
-                                   &key, &devdata, 0)) {
-    if (errno == EAGAIN)
+  while ((errno = db->db_devino->get(db->db_devino, NULL,
+                                   &key, &devdata, 0))) {
+    if (errno == DB_LOCK_DEADLOCK)
       continue;
 
     if (errno == DB_NOTFOUND) {
@@ -80,9 +81,9 @@ cnid_t cnid_lookup(void *CNID,
   key.data = buf + CNID_DEVINO_LEN;
   key.size = CNID_DID_LEN + len + 1;
   memset(&diddata, 0, sizeof(diddata));
-  while (errno = db->db_didname->get(db->db_didname, NULL,
-                                      &key, &diddata, 0)) {
-    if (errno == EAGAIN)
+  while ((errno = db->db_didname->get(db->db_didname, NULL,
+                                      &key, &diddata, 0))) {
+    if (errno == DB_LOCK_DEADLOCK)
       continue;
 
     if (errno == DB_NOTFOUND) {
@@ -115,3 +116,4 @@ cnid_t cnid_lookup(void *CNID,
     syslog(LOG_ERR, "cnid_lookup: looked up did %d, name %s as %d (needed update)", did, name, id);
   return id;
 }
+#endif /* CNID_DB */