(_file_write): Return ENOSPC if fwrite returns 0.
Showing
1 changed file
with
3 additions
and
1 deletions
... | @@ -163,7 +163,7 @@ _file_readline (mu_stream_t stream, char *optr, size_t osize, | ... | @@ -163,7 +163,7 @@ _file_readline (mu_stream_t stream, char *optr, size_t osize, |
163 | 163 | ||
164 | static int | 164 | static int |
165 | _file_write (mu_stream_t stream, const char *iptr, size_t isize, | 165 | _file_write (mu_stream_t stream, const char *iptr, size_t isize, |
166 | mu_off_t offset, size_t *nbytes) | 166 | mu_off_t offset, size_t *nbytes) |
167 | { | 167 | { |
168 | struct _file_stream *fs = mu_stream_get_owner (stream); | 168 | struct _file_stream *fs = mu_stream_get_owner (stream); |
169 | size_t n; | 169 | size_t n; |
... | @@ -188,6 +188,8 @@ _file_write (mu_stream_t stream, const char *iptr, size_t isize, | ... | @@ -188,6 +188,8 @@ _file_write (mu_stream_t stream, const char *iptr, size_t isize, |
188 | { | 188 | { |
189 | if (feof (fs->file) == 0) | 189 | if (feof (fs->file) == 0) |
190 | err = EIO; | 190 | err = EIO; |
191 | else if (n == 0) | ||
192 | err = ENOSPC; | ||
191 | clearerr(fs->file); | 193 | clearerr(fs->file); |
192 | n = 0; | 194 | n = 0; |
193 | } | 195 | } | ... | ... |
-
Please register or sign in to post a comment