diff options
author | 2020-08-14 12:00:33 +0000 | |
---|---|---|
committer | 2020-08-14 12:00:33 +0000 | |
commit | ac593df8eb280317c6c3cf3013e2b2f08f75bb18 (patch) | |
tree | c6113aafbc8186ef375aed077613674ecb6ddc0d /lib/libc/stdio/fmemopen.c | |
parent | When detaching common remote coverage, do not clear any fields. Instead, (diff) | |
download | wireguard-openbsd-ac593df8eb280317c6c3cf3013e2b2f08f75bb18.tar.xz wireguard-openbsd-ac593df8eb280317c6c3cf3013e2b2f08f75bb18.zip |
Fix handling of "w+" mode, we were only truncating for "w".
OK martijn@ mpi@
Diffstat (limited to 'lib/libc/stdio/fmemopen.c')
-rw-r--r-- | lib/libc/stdio/fmemopen.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdio/fmemopen.c b/lib/libc/stdio/fmemopen.c index 00c27646b96..35b0ff7062a 100644 --- a/lib/libc/stdio/fmemopen.c +++ b/lib/libc/stdio/fmemopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fmemopen.c,v 1.3 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: fmemopen.c,v 1.4 2020/08/14 12:00:33 millert Exp $ */ /* * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org> @@ -144,7 +144,7 @@ fmemopen(void *buf, size_t size, const char *mode) } st->pos = 0; - st->len = (oflags & O_WRONLY) ? 0 : size; + st->len = (oflags & O_TRUNC) ? 0 : size; st->size = size; st->update = oflags & O_RDWR; |