Index: fsvs/src/direnum.c
===================================================================
--- fsvs/src/direnum.c	(Revision 1209)
+++ fsvs/src/direnum.c	(Arbeitskopie)
@@ -330,7 +330,15 @@
 	return 0;
 }
 
+int line;
+void ki(int why)
+{
+  printf("KILL at %d - %d\n", line, why);
+  exit(0);
+}
 
+#define D line=__LINE__; mcheck(ki);
+
 /** -.
  * The entries are sorted by inode number and stat()ed.
  *
@@ -412,6 +420,7 @@
 	 * without the \0) */
 	alloc_count=this->st.size/(sizeof(*p_de) - sizeof(p_de->d_name) + 
 			ESTIMATED_ENTRY_LENGTH +1);
+//		if (this->st.size < 1024) alloc_count=this->st.size*ESTIMATED_ENTRY_LENGTH;
 	/* + ca. 20% */
 	est_count= (est_count*19)/16 +1; 
 	if (alloc_count > est_count) est_count=alloc_count;
@@ -433,6 +442,7 @@
 	/* read the directory and count entries */
 	while ( (i=dir__enum(dirhandle, (fsvs_dirent*)buffer, sizeof(buffer))) >0)
 	{
+	D
 		/* count entries, copy name and inode nr */
 		j=0;
 		while (j<i)
@@ -447,22 +457,52 @@
 				else
 					alloc_count=alloc_count*19/16;
 
-				names=realloc(names, alloc_count*sizeof(*names));
+	D
+				names=realloc(names, alloc_count*sizeof(*names)+8);
 				STOPIF_ENOMEM( !names);
 
+	D
 				/* temporarily we store the inode number in the *entries_by_inode
 				 * space; that changes when we've sorted them. */
-				inode_numbers=realloc(inode_numbers, alloc_count*sizeof(*inode_numbers));
+				inode_numbers=realloc(inode_numbers, alloc_count*sizeof(*inode_numbers)+8);
+	D
 				STOPIF_ENOMEM(!inode_numbers);
+	D
 			}
 
+	D
 			p_de=(fsvs_dirent*)(buffer+j);
 
-			DEBUGP("found %llu %s", (t_ull)p_de->d_ino, p_de->d_name);
 
+			// ich schau mal was im internet nach - cvs von libc6.
+			DEBUGP("found %s %llu A%4d c%4d "
+			"names=%p %08X %08X %08X %08X"
+			"inode=%p %08X %08X %08X %08X"
+			"strings=%p %08X %08X %08X %08X"
+			, 
+			p_de->d_name,
+			p_de->d_ino,
+					alloc_count, count,
+					names,
+					((unsigned*)names)[-4],
+					((unsigned*)names)[-3],
+					((unsigned*)names)[-2],
+					((unsigned*)names)[-4],
+					inode_numbers,
+					((unsigned*)inode_numbers)[-4],
+					((unsigned*)inode_numbers)[-3],
+					((unsigned*)inode_numbers)[-2],
+					((unsigned*)inode_numbers)[-4],
+					strings,
+					((unsigned*)strings)[-4],
+					((unsigned*)strings)[-3],
+					((unsigned*)strings)[-2],
+					((unsigned*)strings)[-4]
+			      );
+	D
 			if (p_de->d_name[0] == '.' &&
 					((p_de->d_name[1] == '.' &&
-						p_de->d_name[2] == '\0') ||
+					  p_de->d_name[2] == '\0') ||
 					 (p_de->d_name[1] == '\0')) )
 			{
 				/* just ignore . and .. */
@@ -470,23 +510,31 @@
 			else
 			{
 				/* store inode for sorting */
+	D
 				inode_numbers[count] = p_de->d_ino;
+	D
 
 				/* Store pointer to name.
 				 * In case of a realloc all pointers to the strings would get 
 				 * invalid. So don't store the addresses now - only offsets. */
 				names[count] = mark;
 
+	D
 				/* copy name, mark space as used */
 				l=strlen(p_de->d_name);
+	D
 				strcpy(strings+mark, p_de->d_name);
+	D
 				mark += l+1;
+	D
 
 				count++;
+	D
 			}
 
 			/* next */
 			j += p_de->d_reclen;
+	D
 		}
 
 		/* Check for free space.
@@ -494,6 +542,7 @@
 		 * so it's enough to have FREE_SPACE bytes free.
 		 * Especially because there are some padding and pointer bytes
 		 * which get discarded. */
+	D
 		if (size-mark < FREE_SPACE)
 		{
 			/* Oh no. Have to reallocate.
@@ -502,10 +551,15 @@
 			 *
 			 * How much should we add? For now, just give about 30%. */
 			/* size*21: Let's hope that this won't overflow :-) */ 
+	D
 			size=(size*21)/16;
+	D
 			strings=realloc(strings, size);
+	D
 			DEBUGP("strings realloc(%p, %d)", strings, size);
+	D
 			STOPIF_ENOMEM( !strings);
+	D
 		}
 	}
 
@@ -580,7 +634,7 @@
 		if (status == ENOENT)
 		{
 			STOPIF( wa__warn(WRN__LOCAL_VANISHED, status,
-				"Eintrag %s nicht mehr gefunden!", sts->name), NULL);
+						"Eintrag %s nicht mehr gefunden!", sts->name), NULL);
 			sts->entry_type=FT_IGNORE;
 		}
 		else
