aboutsummaryrefslogtreecommitdiff
path: root/gacopyz
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2006-11-04 13:50:16 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2006-11-04 13:50:16 +0000
commit25b83ac9a8327ae83754c044cab47f3c29f2ecde (patch)
treec880563c36f2bef599e637fb37b5d49e566a373e /gacopyz
parent178200895e3b849eb0472dba04e95085599784bc (diff)
downloadmailfromd-25b83ac9a8327ae83754c044cab47f3c29f2ecde.tar.gz
mailfromd-25b83ac9a8327ae83754c044cab47f3c29f2ecde.tar.bz2
(ctx_read,ctx_write): Return immediately on timeout and eof.
git-svn-id: file:///svnroot/mailfromd/trunk@783 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'gacopyz')
-rw-r--r--gacopyz/gacopyz.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/gacopyz/gacopyz.c b/gacopyz/gacopyz.c
index 5bb7f89d..f081fadb 100644
--- a/gacopyz/gacopyz.c
+++ b/gacopyz/gacopyz.c
@@ -447,8 +447,12 @@ ctx_read(SMFICTX *ctx, char *buf, size_t size)
res = select(ctx->sd + 1, &rset, NULL, &xset, &to);
if (res == 0) {
+ gacopyz_log(ctx->conn,
+ SMI_LOG_ERR,
+ "ctx_read: connection timed out");
errno = ETIMEDOUT;
- continue;
+ rc = MI_FAILURE;
+ break;
} else if (res < 0) {
if (errno == EINTR)
continue;
@@ -473,6 +477,12 @@ ctx_read(SMFICTX *ctx, char *buf, size_t size)
strerror(errno));
rc = MI_FAILURE;
break;
+ } else if (res == 0) {
+ gacopyz_log(ctx->conn,
+ SMI_LOG_ERR,
+ "ctx_read: end of file");
+ rc = MI_FAILURE;
+ break;
}
buf += res;
@@ -501,8 +511,12 @@ ctx_write(SMFICTX *ctx, char *buf, size_t size)
res = select(ctx->sd + 1, NULL, &wset, &xset, &to);
if (res == 0) {
+ gacopyz_log(ctx->conn,
+ SMI_LOG_ERR,
+ "ctx_write: connection timed out");
errno = ETIMEDOUT;
- continue;
+ rc = MI_FAILURE;
+ break;
} else if (res < 0) {
if (errno == EINTR)
continue;
@@ -527,7 +541,13 @@ ctx_write(SMFICTX *ctx, char *buf, size_t size)
strerror(errno));
rc = MI_FAILURE;
break;
- }
+ } else if (res == 0) {
+ gacopyz_log(ctx->conn,
+ SMI_LOG_ERR,
+ "ctx_write: wrote 0 bytes");
+ rc = MI_FAILURE;
+ break;
+ }
buf += res;
size -= res;

Return to:

Send suggestions and report system problems to the System administrator.