diff --git a/libc/stdio/open_memstream.c b/libc/stdio/open_memstream.c
index 7e8e2134f..716d8666e 100644
--- a/libc/stdio/open_memstream.c
+++ b/libc/stdio/open_memstream.c
@@ -188,6 +188,10 @@ FILE *open_memstream(char **bufloc, size_t *sizeloc)
 		 * nothing currently in the FILE's write buffer. */
 
 		if (fp != NULL) {
+			/* POSIX: "The stream associated with a call to
+			 * open_memstream() shall be byte-oriented."  fopencookie()
+			 * leaves it unoriented. */
+			__STDIO_STREAM_SET_NARROW(fp);
 			__STDIO_STREAM_VALIDATE(fp);
 			return fp;
 		}
