From: franklahm <fra...@us...> - 2009-12-23 10:18:58
|
Update of /cvsroot/netatalk/netatalk/etc/cnid_dbd In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv21543 Modified Files: dbd_rebuild_add.c Log Message: Untabify and reindent Index: dbd_rebuild_add.c =================================================================== RCS file: /cvsroot/netatalk/netatalk/etc/cnid_dbd/dbd_rebuild_add.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dbd_rebuild_add.c 6 May 2009 11:54:24 -0000 1.3 --- dbd_rebuild_add.c 23 Dec 2009 10:18:48 -0000 1.4 *************** *** 29,33 **** DBT key, data; cnid_t cur, tmp, id; ! memset(&key, 0, sizeof(key)); memset(&data, 0, sizeof(data)); --- 29,33 ---- DBT key, data; cnid_t cur, tmp, id; ! memset(&key, 0, sizeof(key)); memset(&data, 0, sizeof(data)); *************** *** 45,75 **** if (dbif_put(dbd, DBIF_CNID, &key, &data, 0) < 0) { ! rply->result = CNID_DBD_RES_ERR_DB; ! return -1; } ! key.data = ROOTINFO_KEY; key.size = ROOTINFO_KEYLEN; ! if (dbif_get(dbd, DBIF_CNID, &key, &data, 0) <= 0) { ! /* FIXME: If we cannot find ROOTINFO_KEY, should this be considered fatal or should we just return 0 and roll back? */ ! rply->result = CNID_DBD_RES_ERR_DB; ! return -1; } ! ! memcpy(&tmp, (char *) data.data + CNID_TYPE_OFS, sizeof(cnid_t)); cur = ntohl(tmp); id = ntohl(rqst->cnid); if (id > cur) { ! data.size = ROOTINFO_DATALEN; ! memcpy((char *) data.data + CNID_TYPE_OFS, &rqst->cnid, sizeof(cnid_t)); ! if (dbif_put(dbd, DBIF_CNID, &key, &data, 0) < 0) { ! rply->result = CNID_DBD_RES_ERR_DB; ! return -1; ! } } ! rply->cnid = rqst->cnid; rply->result = CNID_DBD_RES_OK; --- 45,75 ---- if (dbif_put(dbd, DBIF_CNID, &key, &data, 0) < 0) { ! rply->result = CNID_DBD_RES_ERR_DB; ! return -1; } ! key.data = ROOTINFO_KEY; key.size = ROOTINFO_KEYLEN; ! if (dbif_get(dbd, DBIF_CNID, &key, &data, 0) <= 0) { ! /* FIXME: If we cannot find ROOTINFO_KEY, should this be considered fatal or should we just return 0 and roll back? */ ! rply->result = CNID_DBD_RES_ERR_DB; ! return -1; } ! ! memcpy(&tmp, (char *) data.data + CNID_TYPE_OFS, sizeof(cnid_t)); cur = ntohl(tmp); id = ntohl(rqst->cnid); if (id > cur) { ! data.size = ROOTINFO_DATALEN; ! memcpy((char *) data.data + CNID_TYPE_OFS, &rqst->cnid, sizeof(cnid_t)); ! if (dbif_put(dbd, DBIF_CNID, &key, &data, 0) < 0) { ! rply->result = CNID_DBD_RES_ERR_DB; ! return -1; ! } } ! rply->cnid = rqst->cnid; rply->result = CNID_DBD_RES_OK; |