Index: hfaentry.cpp
===================================================================
--- hfaentry.cpp	(revision 11358)
+++ hfaentry.cpp	(working copy)
@@ -301,6 +301,8 @@
         memset( pabyData + nDataSize, 0, nSize - nDataSize );
         nDataSize = nSize;
 
+		nFilePos = 0;
+
         MarkDirty();
     }
 
@@ -611,7 +613,18 @@
                                  const char * pszValue )
 
 {
-    return SetFieldValue( pszFieldPath, 's', (void *) pszValue );
+	CPLErr result = SetFieldValue( pszFieldPath, 's', (void *) pszValue );
+/* -------------------------------------------------------------------- */
+/*      This is a hack that tries to grow the string field for the      */
+/*      RRDNamesList entry, Ticket 1109 
+/* -------------------------------------------------------------------- */
+	if (result != CE_None && EQUALN(szName, "RRDNamesList",12))
+	{
+		// We failed to set the RRDNameList field, try to grow the entry and see if it helps
+		MakeData(nDataSize + 3000);
+		result = SetFieldValue( pszFieldPath, 's', (void *) pszValue );
+	}
+    return result;
 }
 
 /************************************************************************/
@@ -657,6 +670,14 @@
 
         if( nDataSize > 0 )
             nDataPos = nFilePos + psHFA->nEntryHeaderLength;
+/* -------------------------------------------------------------------- */
+/*      We got a new position in the file, make sure that all pointers  */
+/*      are updated.                                                    */ 
+/* -------------------------------------------------------------------- */		
+		if (poPrev != NULL) poPrev->MarkDirty();
+		if (poNext != NULL) poNext->MarkDirty();
+		if (poChild != NULL) poChild->MarkDirty();
+		if (poParent != NULL) poParent->MarkDirty();
     }
 
 /* -------------------------------------------------------------------- */

