ossp-pkg/sa/sa.c 1.36 -> 1.37
--- sa.c 2001/10/24 12:11:31 1.36
+++ sa.c 2001/10/31 11:45:35 1.37
@@ -1453,14 +1453,12 @@
if (sa->fdSocket == -1)
return SA_ERR_USE;
- /* trigger a write buffer flush */
- if (sa->nWriteLen > 0)
- sa_flush(sa);
-
/* perform read operation */
rv = SA_OK;
if (sa->nReadSize == 0) {
/* user-space unbuffered I/O */
+ if (sa->nWriteLen > 0)
+ sa_flush(sa);
res = sa_read_raw(sa, cpBuf, nBufReq);
if (res == 0)
rv = SA_ERR_EOF;
@@ -1489,6 +1487,8 @@
res += sa->nReadLen;
sa->nReadLen = 0;
}
+ if (sa->nWriteLen > 0)
+ sa_flush(sa);
if (nBufReq >= sa->nReadSize) {
/* buffer is too small at all, so read directly */
n = sa_read_raw(sa, cpBuf, nBufReq);
|
|