"Billy Gray" <[EMAIL PROTECTED]> writes: > char *buffer = (char *) xmalloc (STDIN_BLOCK); //xmalloc is really > malloc > int offset = 0; > int read = 1; > int size = STDIN_BLOCK;
> while ( (read > 0) && (offset <= STDIN_MAX) ) > { > syslog (LOG_DEBUG, "Reading a block..."); > read = fread (buffer + offset, 1, STDIN_BLOCK, stdin); > offset += read; > if (read == STDIN_BLOCK) > { > size += STDIN_BLOCK; > buffer = xrealloc (buffer, size); > } > } // while This looks to me like it risks telling fread to read more bytes than will actually fit in the buffer at the moment. Think about what happens if fread returns only a partial bufferload on any particular call. I'm guessing you're clobbering memory ... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings