]> arthur.barton.de Git - netatalk.git/commitdiff
removed unneeded cnid_lookups; fixed a bug in afp_createid.
authoruhees <uhees>
Mon, 27 Aug 2001 15:26:16 +0000 (15:26 +0000)
committeruhees <uhees>
Mon, 27 Aug 2001 15:26:16 +0000 (15:26 +0000)
etc/afpd/enumerate.c
etc/afpd/file.c
etc/afpd/fork.c

index de5873aede2b7717c8bc9e443a87e42bd3094e77..b67672e1a30d2c396c93ea3d45a8df9224fd0a49 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: enumerate.c,v 1.7 2001-08-15 01:37:34 srittau Exp $
+ * $Id: enumerate.c,v 1.8 2001-08-27 15:26:16 uhees Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -62,24 +62,15 @@ adddir( vol, dir, name, namlen, upath, upathlen, st )
     strcpy( cdir->d_name, name );
     cdir->d_name[namlen] = '\0';
 
-       cdir->d_did = 0;
+    cdir->d_did = 0;
 
-#ifdef CNID_DB
-    /* find out if we have a fixed did already */
-    cdir->d_did = cnid_lookup(vol->v_db, st, dir->d_did, upath,
-                                   upathlen);
-#endif /* CNID_DB */
-
-       if (cdir->d_did == 0) {
 #if AD_VERSION > AD_VERSION1
-         memset(&ad, 0, sizeof(ad));
-      if (ad_open(upath, ADFLAGS_HF|ADFLAGS_DIR, O_RDONLY, 0, &ad) < 0) {
-        /* if we can't parse the AppleDouble header, return 0 for the DID */
-       cdir->d_did = 0;
-      } else {
-        /* ... else retrieve the DID entry into cdir->d_did */
-       memcpy(&cdir->d_did, ad_entry(&ad, ADEID_DID), sizeof(cdir->d_did));
-       ad_close(&ad, ADFLAGS_HF);
+    /* look in AD v2 header */
+    memset(&ad, 0, sizeof(ad));
+    if (ad_open(upath, ADFLAGS_HF|ADFLAGS_DIR, O_RDONLY, 0, &ad) >= 0) {
+        /* if we can parse the AppleDouble header, retrieve the DID entry into cdir->d_did */
+           memcpy(&cdir->d_did, ad_entry(&ad, ADEID_DID), sizeof(cdir->d_did));
+           ad_close(&ad, ADFLAGS_HF);
        }
 #endif /* AD_VERSION */
 
@@ -88,7 +79,6 @@ adddir( vol, dir, name, namlen, upath, upathlen, st )
     cdir->d_did = cnid_add(vol->v_db, st, dir->d_did, upath,
                                   upathlen, cdir->d_did);
 #endif /* CNID_DB */
-       }
 
        if (cdir->d_did == 0) {
 #ifdef USE_LASTDID
index 2a3c83a2e87b9a6fccb243dde46bb1a31175b544..d25c50f6d498fad1f0fbf85e5e4decfd2b3f2f61 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.c,v 1.26 2001-08-15 01:37:34 srittau Exp $
+ * $Id: file.c,v 1.27 2001-08-27 15:26:16 uhees Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -200,25 +200,16 @@ int getfilparams(struct vol *vol,
 
        case FILPBIT_FNUM :
                aint = 0;
-#ifdef CNID_DB
-               /* find out if we have a fixed did already */
-               aint = cnid_lookup(vol->v_db, st, dir->d_did, upath,
-                                                   strlen(upath));
-#endif /* CNID_DB */
-
-         /* look in AD v2 header */
-           if (aint == 0)
-               {
 #if AD_VERSION > AD_VERSION1
-          if (isad)
+        /* look in AD v2 header */
+        if (isad)
                        memcpy(&aint, ad_entry(adp, ADEID_DID), sizeof(aint));
 #endif /* AD_VERSION > AD_VERSION1 */
 
 #ifdef CNID_DB
-             aint = cnid_add(vol->v_db, st, dir->d_did, upath,
+        aint = cnid_add(vol->v_db, st, dir->d_did, upath,
                                                        strlen(upath), aint);
 #endif /* CNID_DB */
-               }
 
                if (aint == 0) {
            /*
@@ -1339,19 +1330,17 @@ int afp_createid(obj, ibuf, ibuflen, rbuf, rbuflen )
 
 #if AD_VERSION > AD_VERSION1
     memset(&ad, 0, sizeof(ad));
-    if (ad_open( upath, ADFLAGS_HF, O_RDONLY, 0, &ad ) < 0)
-      id = 0;
-    else {
+    if (ad_open( upath, ADFLAGS_HF, O_RDONLY, 0, &ad ) >= 0) {
       memcpy(&id, ad_entry(&ad, ADEID_DID), sizeof(id));
       ad_close(&ad, ADFLAGS_HF);
     }
+#endif /* AD_VERSION > AD_VERSION1 */
 
     if (id = cnid_add(vol->v_db, &st, did, upath, len, id)) {
       memcpy(rbuf, &id, sizeof(id));
       *rbuflen = sizeof(id);
       return AFP_OK;
     }
-#endif /* AD_VERSION > AD_VERSION1 */
 
 #ifdef DEBUG
     syslog(LOG_INFO, "ending afp_createid...:");
index 67446661b6a7d6f6605b8cc4d18889104e6148db..f0bab5ec96f58348bc879b985881636b345cdff4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: fork.c,v 1.7 2001-08-15 01:37:34 srittau Exp $
+ * $Id: fork.c,v 1.8 2001-08-27 15:26:16 uhees Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -176,27 +176,17 @@ static int getforkparams(ofork, bitmap, buf, buflen, attrbits )
 
        case FILPBIT_FNUM :
                aint = 0;
-#ifdef CNID_DB
-               /* find out if we have a fixed did already */
-               aint = cnid_lookup(ofork->of_vol->v_db, &st,
-                                 ofork->of_dir->d_did,
-                                 upath, strlen(upath));
-#endif /* CNID_DB */
-
-         /* look in AD v2 header */
-           if (aint == 0)
-               {
 #if AD_VERSION > AD_VERSION1
-          if (isad)
+        /* look in AD v2 header */
+        if (isad)
                memcpy(&aint, ad_entry(ofork->of_ad, ADEID_DID), sizeof(aint));
 #endif /* AD_VERSION > AD_VERSION1 */
 
 #ifdef CNID_DB
-             aint = cnid_add(ofork->of_vol->v_db, &st,
+        aint = cnid_add(ofork->of_vol->v_db, &st,
                                  ofork->of_dir->d_did,
                                  upath, strlen(upath), aint);
 #endif /* CNID_DB */
-               }
 
                if (aint == 0) {
 #ifdef AFS