diff options
Diffstat (limited to 'net/netatalk-devel/files/patch-aa')
-rw-r--r-- | net/netatalk-devel/files/patch-aa | 177 |
1 files changed, 177 insertions, 0 deletions
diff --git a/net/netatalk-devel/files/patch-aa b/net/netatalk-devel/files/patch-aa new file mode 100644 index 000000000000..c440f1393054 --- /dev/null +++ b/net/netatalk-devel/files/patch-aa @@ -0,0 +1,177 @@ +--- libatalk/cnid/cnid_add.c.orig Thu Aug 16 10:30:29 2001 ++++ libatalk/cnid/cnid_add.c Sun Sep 2 03:15:54 2001 +@@ -13,6 +13,7 @@ + #include "config.h" + #endif /* HAVE_CONFIG_H */ + ++#ifdef CNID_DB + #include <stdio.h> + #include <sys/param.h> + #include <sys/stat.h> +@@ -41,23 +42,27 @@ + { + DBT altkey, altdata; + DB_TXN *tid; ++ /* We create rc here because using rc is bad. Why? Well, if you ++ * use rc once, then call another function which resets it, you're ++ * screwed. */ ++ int rc = 0; + + memset(&altkey, 0, sizeof(altkey)); + memset(&altdata, 0, sizeof(altdata)); + + retry: +- if ((errno = txn_begin(db->dbenv, ptid, &tid,0))) { +- return errno; ++ if ((rc = txn_begin(db->dbenv, ptid, &tid,0))) { ++ return rc; + } + + /* main database */ +- if ((errno = db->db_cnid->put(db->db_cnid, tid, ++ if ((rc = db->db_cnid->put(db->db_cnid, tid, + key, data, DB_NOOVERWRITE))) { + txn_abort(tid); +- if (errno == DB_LOCK_DEADLOCK) ++ if (rc == DB_LOCK_DEADLOCK) + goto retry; + +- return errno; ++ return rc; + } + + /* dev/ino database */ +@@ -65,25 +70,25 @@ + altkey.size = CNID_DEVINO_LEN; + altdata.data = key->data; + altdata.size = key->size; +- if ((errno = db->db_devino->put(db->db_devino, tid, ++ if ((rc = db->db_devino->put(db->db_devino, tid, + &altkey, &altdata, 0))) { + txn_abort(tid); +- if (errno == DB_LOCK_DEADLOCK) ++ if (rc == DB_LOCK_DEADLOCK) + goto retry; + +- return errno; ++ return rc; + } + + /* did/name database */ + altkey.data = (char *) data->data + CNID_DEVINO_LEN; + altkey.size = data->size - CNID_DEVINO_LEN; +- if ((errno = db->db_didname->put(db->db_didname, tid, ++ if ((rc = db->db_didname->put(db->db_didname, tid, + &altkey, &altdata, 0))) { + txn_abort(tid); +- if (errno == DB_LOCK_DEADLOCK) ++ if (rc == DB_LOCK_DEADLOCK) + goto retry; + +- return errno; ++ return rc; + } + + return txn_commit(tid, 0); +@@ -100,6 +105,7 @@ + DBT rootinfo_key, rootinfo_data; + DB_TXN *tid; + cnid_t id, save; ++ int rc = 0; + + int debug = 0; + +@@ -137,8 +143,8 @@ + * cnid's to the database. */ + if (ntohl(hint) >= CNID_START) { + /* if the key doesn't exist, add it in. don't fiddle with nextID. */ +- errno = add_cnid(db, NULL, &key, &data); +- switch (errno) { ++ rc = add_cnid(db, NULL, &key, &data); ++ switch (rc) { + case DB_KEYEXIST: /* need to use RootInfo after all. */ + break; + default: +@@ -153,14 +159,14 @@ + + /* Abort and retry the modification. */ + if (0) { +-retry: if ((errno = txn_abort(tid)) != 0) +- syslog(LOG_ERR, "cnid_add: txn_begin failed (%d)", errno); ++retry: if ((rc = txn_abort(tid)) != 0) ++ syslog(LOG_ERR, "cnid_add: txn_begin failed (%d)", rc); + /* FALLTHROUGH */ + } + + /* Begin the transaction. */ +- if ((errno = txn_begin(db->dbenv, NULL, &tid, 0)) != 0) { +- syslog(LOG_ERR, "cnid_add: txn_begin failed (%d)", errno); ++ if ((rc = txn_begin(db->dbenv, NULL, &tid, 0)) != 0) { ++ syslog(LOG_ERR, "cnid_add: txn_begin failed (%d)", rc); + goto cleanup_err; + } + +@@ -172,7 +178,7 @@ + rootinfo_key.size = ROOTINFO_KEYLEN; + + /* Get the key. */ +- switch (errno = db->db_didname->get(db->db_didname, tid, &rootinfo_key, &rootinfo_data, 0)) { ++ switch (rc = db->db_didname->get(db->db_didname, tid, &rootinfo_key, &rootinfo_data, 0)) { + case DB_LOCK_DEADLOCK: + goto retry; + case 0: +@@ -186,7 +192,7 @@ + syslog(LOG_ERR, "cnid_add: using CNID_START for did %d, name %s as %d", did, name, hint); + break; + default: +- syslog(LOG_ERR, "cnid_add: unable to lookup rootinfo (%d)", errno); ++ syslog(LOG_ERR, "cnid_add: unable to lookup rootinfo (%d)", rc); + goto cleanup_abort; + } + +@@ -194,12 +200,12 @@ + * wrap-around. NOTE: i do it this way so that we can go back and + * fill in holes. */ + save = id = ntohl(hint); +- while ((errno = add_cnid(db, tid, &key, &data))) { ++ while ((rc = add_cnid(db, tid, &key, &data))) { + /* don't use any of the special CNIDs */ + if (++id < CNID_START) + id = CNID_START; + +- if ((errno != DB_KEYEXIST) || (save == id)) { ++ if ((rc != DB_KEYEXIST) || (save == id)) { + syslog(LOG_ERR, "cnid_add: unable to add CNID(%x)", hint); + hint = 0; + goto cleanup_abort; +@@ -211,21 +217,21 @@ + rootinfo_data.data = &hint; + rootinfo_data.size = sizeof(hint); + +- switch (errno = db->db_didname->put(db->db_didname, tid, &rootinfo_key, &rootinfo_data, 0)) { ++ switch (rc = db->db_didname->put(db->db_didname, tid, &rootinfo_key, &rootinfo_data, 0)) { + case DB_LOCK_DEADLOCK: + goto retry; + case 0: + break; + default: +- syslog(LOG_ERR, "cnid_add: unable to update rootinfo (%d)", errno); ++ syslog(LOG_ERR, "cnid_add: unable to update rootinfo (%d)", rc); + goto cleanup_abort; + } + + + cleanup_commit: + /* The transaction finished, commit it. */ +- if ((errno = txn_commit(tid, 0)) != 0) { +- syslog(LOG_ERR, "cnid_add: txn_commit failed (%d)", errno); ++ if ((rc = txn_commit(tid, 0)) != 0) { ++ syslog(LOG_ERR, "cnid_add: txn_commit failed (%d)", rc); + goto cleanup_err; + } + +@@ -239,3 +245,4 @@ + cleanup_err: + return 0; + } ++#endif /* CNID_DB */ |