/*
- * $Id: ad_attr.c,v 1.12 2009-12-22 14:45:38 franklahm Exp $
+ * $Id: ad_attr.c,v 1.13 2009-12-23 07:21:08 franklahm Exp $
*/
#ifdef HAVE_CONFIG_H
{
if ((adp->ad_flags == AD_VERSION2) && (adp->ad_options & ADVOL_CACHE)) {
+ /* ad_getid depends on this to detect presence of ALL entries */
+ ad_setentrylen( adp, ADEID_PRIVID, sizeof(id));
+ memcpy(ad_entry( adp, ADEID_PRIVID ), &id, sizeof(id));
+
ad_setentrylen( adp, ADEID_PRIVDEV, sizeof(dev_t));
if ((adp->ad_options & ADVOL_NODEV)) {
memset(ad_entry( adp, ADEID_PRIVDEV ), 0, sizeof(dev_t));
ad_setentrylen( adp, ADEID_PRIVINO, sizeof(ino_t));
memcpy(ad_entry( adp, ADEID_PRIVINO ), &ino, sizeof(ino_t));
- ad_setentrylen( adp, ADEID_PRIVID, sizeof(id));
- memcpy(ad_entry( adp, ADEID_PRIVID ), &id, sizeof(id));
-
ad_setentrylen( adp, ADEID_DID, sizeof(did));
memcpy(ad_entry( adp, ADEID_DID ), &did, sizeof(did));
* note inode and device are opaques and not in network order
* only use the ID if adouble is writable for us.
*/
- if (adp && ( adp->ad_options & ADVOL_CACHE) && (adp->ad_md->adf_flags & O_RDWR )) {
+ if (adp
+ && ( adp->ad_options & ADVOL_CACHE)
+ && (adp->ad_md->adf_flags & O_RDWR )
+ && (sizeof(dev_t) == ad_getentrylen(adp, ADEID_PRIVID)) /* One check to ensure ALL values are there */
+ ) {
memcpy(&dev, ad_entry(adp, ADEID_PRIVDEV), sizeof(dev_t));
memcpy(&ino, ad_entry(adp, ADEID_PRIVINO), sizeof(ino_t));
memcpy(temp, ad_entry(adp, ADEID_PRIVSYN), sizeof(temp));