diff -ur portage-utils-0.62_orig/main.c portage-utils-0.62/main.c --- portage-utils-0.62_orig/main.c 2016-02-22 19:31:41.000000000 +0100 +++ portage-utils-0.62/main.c 2016-11-14 21:09:11.087060551 +0100 @@ -182,6 +182,7 @@ struct stat s; char *buf; size_t read_size; + printf ("DEBUG eat_file_fd entry bufptr=%p *bufptr=%p\n",bufptr, *bufptr ); /* First figure out how much data we should read from the fd. */ if (fd == -1 || fstat(fd, &s) != 0) { @@ -203,9 +204,12 @@ * constantly. So we round up a few pages as wasiting virtual * memory is cheap when it is unused. */ *bufsize = ((read_size + 1) + BUFSIZE - 1) & -BUFSIZE; + printf ("DEBUG: calling xrealloc.\nOld *bufptr=%p\n",*bufptr); *bufptr = xrealloc(*bufptr, *bufsize); + printf ("New *bufprt=%p\n",*bufptr); } buf = *bufptr; + printf ("DEBUG: pre-crash *bufptr=%p\n", *bufptr); /* Finally do the actual read. */ buf[0] = '\0'; @@ -220,6 +224,7 @@ buf[read_size - 1] = '\0'; } } + printf("DEBUG: buf = %s\n", buf); return ret; } @@ -1339,6 +1344,15 @@ struct dirent **cat; struct dirent **pf; + slot[0]=0xa; + slot[1]=0xb; + slot[2]=0xa; + slot[3]=0xb; + slot[4]=0xa; + slot[5]=0xb; + slot[6]=0xa; + slot[7]=0xb; + printf ("DEBUG slot created with slot=%p and &slot=%p\n",slot, &slot); depend_atom *atom = NULL; queue *cpf = NULL; @@ -1362,8 +1376,11 @@ * until this is rewritten & merged into libq/vdb.c. */ slot_len = sizeof(slot); strncat(buf, "/SLOT", sizeof(buf)); + printf ("DEBUG pre-eat : slot=%p (char **)&slot=%p\n", slot, (char **)&slot); eat_file_at(ctx->vdb_fd, buf, (char **)&slot, &slot_len); + printf ("DEBUG post-eat: slot=%p (char **)&slot=%p\n", slot, (char **)&slot); rmspace(slot); + printf ("DEBUG post-rm : slot=%p (char **)&slot=%p\n", slot, (char **)&slot); if (fullcpv) { if (atom->PR_int)