diff options
author | assar <assar@FreeBSD.org> | 2001-06-18 04:44:23 +0000 |
---|---|---|
committer | assar <assar@FreeBSD.org> | 2001-06-18 04:44:23 +0000 |
commit | 4c51e07cb56294605c0ed4bc0ca70602438ccd79 (patch) | |
tree | 4c24782e5063e27f63c4136644a63b7513484d18 /lib/libc | |
parent | d9a93f32bcdb8c85b1af40b22bfed42fdead264a (diff) | |
download | FreeBSD-src-4c51e07cb56294605c0ed4bc0ca70602438ccd79.zip FreeBSD-src-4c51e07cb56294605c0ed4bc0ca70602438ccd79.tar.gz |
(cantwrite): do not allocate memory for a NULL string
PR: misc/26044
MFC after: 1 week
Submitted by: bde
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdio/local.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/stdio/local.h b/lib/libc/stdio/local.h index 3e498d3..06fecc9 100644 --- a/lib/libc/stdio/local.h +++ b/lib/libc/stdio/local.h @@ -81,7 +81,8 @@ struct __sFILEX { * Return true iff the given FILE cannot be written now. */ #define cantwrite(fp) \ - ((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && \ + ((((fp)->_flags & __SWR) == 0 || \ + ((fp)->_bf._base == NULL && ((fp)->_flags & __SSTR) == 0)) && \ __swsetup(fp)) /* |