diff options
author | Jeremy Allison <jra@samba.org> | 2008-04-08 15:08:47 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2008-04-08 15:08:47 -0700 |
commit | b360cdfeb9c70832cb022936ae41e94519db6e04 (patch) | |
tree | 00c8ee67ccc59e90bfb26496925ad73759342d66 /source3/lib | |
parent | 51d9e913bbdb349063d5559c074c641fcd4d2ec1 (diff) | |
download | samba-b360cdfeb9c70832cb022936ae41e94519db6e04.tar.gz samba-b360cdfeb9c70832cb022936ae41e94519db6e04.tar.bz2 samba-b360cdfeb9c70832cb022936ae41e94519db6e04.zip |
Check x_fflush returns.
Jeremy.
(This used to be commit 5525dc5f09a79d30f6c52fc3a88c8bce3060e642)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/xfile.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source3/lib/xfile.c b/source3/lib/xfile.c index ee6e581332..d20a95b03a 100644 --- a/source3/lib/xfile.c +++ b/source3/lib/xfile.c @@ -47,7 +47,7 @@ XFILE *x_stderr = &_x_stderr; /* simulate setvbuf() */ int x_setvbuf(XFILE *f, char *buf, int mode, size_t size) { - x_fflush(f); + if (x_fflush(f) != 0) return -1; if (f->bufused) return -1; /* on files being read full buffering is the only option */ @@ -150,7 +150,7 @@ int x_fclose(XFILE *f) int ret; /* make sure we flush any buffered data */ - x_fflush(f); + (void)x_fflush(f); ret = close(f->fd); f->fd = -1; @@ -189,7 +189,9 @@ size_t x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f) if (n == 0) { /* it's full, flush it */ - x_fflush(f); + if (x_fflush(f) != 0) { + return -1; + } continue; } @@ -204,7 +206,9 @@ size_t x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f) int i; for (i=(size*nmemb)-1; i>=0; i--) { if (*(i+(const char *)p) == '\n') { - x_fflush(f); + if (x_fflush(f) != 0) { + return -1; + } break; } } |