/*
- * $Id: enumerate.c,v 1.6 2001-08-14 14:00:10 rufustfirefly 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.
#endif /* USE_LASTDID */
if ((cdir = dirnew(namlen + 1)) == NULL) {
- syslog( LOG_ERR, "adddir: malloc: %m" );
+ syslog( LOG_ERR, "adddir: malloc: %s", strerror(errno) );
return NULL;
}
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 */
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
if ( sd.sd_buflen == 0 ) {
if (( sd.sd_buf = (char *)malloc( SDBUFBRK )) == NULL ) {
- syslog( LOG_ERR, "afp_enumerate: malloc: %m" );
+ syslog( LOG_ERR, "afp_enumerate: malloc: %s", strerror(errno) );
*rbuflen = 0;
return AFPERR_MISC;
}
start = sd.sd_buf;
if ((buf = (char *) realloc( sd.sd_buf, sd.sd_buflen +
SDBUFBRK )) == NULL ) {
- syslog( LOG_ERR, "afp_enumerate: realloc: %m" );
+ syslog( LOG_ERR, "afp_enumerate: realloc: %s",
+ strerror(errno) );
closedir(dp);
*rbuflen = 0;
return AFPERR_MISC;
sd.sd_last++;
if ( stat( sd.sd_last, &st ) < 0 ) {
- syslog( LOG_DEBUG, "afp_enumerate: stat %s: %m", sd.sd_last );
+ syslog( LOG_DEBUG, "afp_enumerate: stat %s: %s",
+ sd.sd_last, strerror(errno) );
sd.sd_last += len + 1;
continue;
}