  	jas_stream_puts(stream, buf);
  	va_end(ap);
  	return ret;
-@@ -992,7 +1001,7 @@ static int mem_resize(jas_stream_memobj_t *m, int bufsize)
+@@ -992,7 +1009,7 @@ static int mem_resize(jas_stream_memobj_t *m, int bufsize)
  	unsigned char *buf;
  
  	assert(m->buf_);

 	}
 
diff --git a/src/libjasper/base/jas_stream.c b/src/libjasper/base/jas_stream.c
index 9a88556..453adcf 100644
--- a/src/libjasper/base/jas_stream.c
+++ b/src/libjasper/base/jas_stream.c
@@ -212,7 +212,7 @@ jas_stream_t *jas_stream_memopen(char *buf, int bufsize)

-	since the file is open. */
 	if (unlink(obj->pathname)) {
-		/* We will try unlinking the file again after it is closed. */
+#ifdef _MSC_VER
+		/* Under UNIX, one can unlink an open file and continue to do I/O
+		on it.  Not all operating systems support this functionality, however.
+		For example, under Microsoft Windows the unlink operation will fail,
+		since the file is open. */
 		obj->flags |= JAS_STREAM_FILEOBJ_DELONCLOSE;
+#else
+		jas_stream_destroy(stream);
+		return 0;
+#endif
 	}
 
 	/* Use full buffering. */
@@ -553,7 +570,7 @@ int jas_stream_printf(jas_stream_t *stream, const char *fmt, ...)
 	int ret;
 
 	va_start(ap, fmt);
