diff options
-rw-r--r-- | lib/libc/stdio/open_memstream.c | 3 | ||||
-rw-r--r-- | lib/libc/stdio/open_wmemstream.c | 3 | ||||
-rw-r--r-- | regress/lib/libc/orientation/orientation_test.c | 16 |
3 files changed, 19 insertions, 3 deletions
diff --git a/lib/libc/stdio/open_memstream.c b/lib/libc/stdio/open_memstream.c index bd96874e959..46105358d33 100644 --- a/lib/libc/stdio/open_memstream.c +++ b/lib/libc/stdio/open_memstream.c @@ -1,4 +1,4 @@ -/* $OpenBSD: open_memstream.c,v 1.2 2013/03/27 15:06:25 mpi Exp $ */ +/* $OpenBSD: open_memstream.c,v 1.3 2013/04/03 03:11:53 guenther Exp $ */ /* * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org> @@ -152,6 +152,7 @@ open_memstream(char **pbuf, size_t *psize) fp->_write = memstream_write; fp->_seek = memstream_seek; fp->_close = memstream_close; + _SET_ORIENTATION(fp, -1); return (fp); } diff --git a/lib/libc/stdio/open_wmemstream.c b/lib/libc/stdio/open_wmemstream.c index 2b8677c3b6a..4ba4cfdc1b5 100644 --- a/lib/libc/stdio/open_wmemstream.c +++ b/lib/libc/stdio/open_wmemstream.c @@ -1,4 +1,4 @@ -/* $OpenBSD: open_wmemstream.c,v 1.1 2013/03/27 15:06:25 mpi Exp $ */ +/* $OpenBSD: open_wmemstream.c,v 1.2 2013/04/03 03:11:53 guenther Exp $ */ /* * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org> @@ -163,6 +163,7 @@ open_wmemstream(wchar_t **pbuf, size_t *psize) fp->_write = wmemstream_write; fp->_seek = wmemstream_seek; fp->_close = wmemstream_close; + _SET_ORIENTATION(fp, 1); return (fp); } diff --git a/regress/lib/libc/orientation/orientation_test.c b/regress/lib/libc/orientation/orientation_test.c index 1d0911d12fd..2d8fb4fd203 100644 --- a/regress/lib/libc/orientation/orientation_test.c +++ b/regress/lib/libc/orientation/orientation_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: orientation_test.c,v 1.3 2011/10/16 14:39:01 stsp Exp $ */ +/* $OpenBSD: orientation_test.c,v 1.4 2013/04/03 03:11:53 guenther Exp $ */ /* * Copyright (c) 2009 Philip Guenther @@ -111,6 +111,8 @@ main(int argc, char *argv[]) { char buffer[BUFSIZ]; wchar_t wbuffer[BUFSIZ]; + char *buf; + wchar_t *wbuf; FILE *f; off_t off; fpos_t pos; @@ -241,6 +243,18 @@ main(int argc, char *argv[]) TEST_WIDE_STD(stdout, wprintf(L"foo")); + /* memory streams */ + f = open_memstream(&buf, &size); + if (!((r = fwide(f, 0)) < 0)) + fail(__LINE__, r, "<", "open_memstream()"); + fclose(f); + f = open_wmemstream(&wbuf, &size); + if (!((r = fwide(f, 0)) > 0)) + fail(__LINE__, r, ">", "open_wmemstream()"); + fclose(f); + + + /* random stuff? */ TEST_UNCHANGED_STD(stderr, perror("foo")); remove(filename); |