Deleted Added
sdiff udiff text old ( 102528 ) new ( 110560 )
full compact
1/*
2 * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 *
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
8 *
9 */
10
11#include <sm/gen.h>
12SM_RCSID("@(#)$Id: comm.c,v 8.54.2.4 2002/12/03 17:32:45 ca Exp $")
13
14#include "libmilter.h"
15#include <sm/errstring.h>
16
17#define FD_Z FD_ZERO(&readset); \
18 FD_SET((unsigned int) sd, &readset); \
19 FD_ZERO(&excset); \
20 FD_SET((unsigned int) sd, &excset)

--- 29 unchanged lines hidden (view full) ---

50 int ret;
51 int save_errno;
52 char *buf;
53 char data[MILTER_LEN_BYTES + 1];
54
55 *cmd = '\0';
56 *rlen = 0;
57
58 i = 0;
59 for (;;)
60 {
61 FD_Z;
62 ret = select(sd + 1, &readset, NULL, &excset, timeout);
63 if (ret == 0)
64 break;
65 else if (ret < 0)

--- 8 unchanged lines hidden (view full) ---

74 return NULL;
75 }
76
77 len = MI_SOCK_READ(sd, data + i, sizeof data - i);
78 if (MI_SOCK_READ_FAIL(len))
79 {
80 smi_log(SMI_LOG_ERR,
81 "%s, mi_rd_cmd: read returned %d: %s",
82 name, (int) len, sm_errstring(errno));
83 *cmd = SMFIC_RECVERR;
84 return NULL;
85 }
86 if (len == 0)
87 {
88 *cmd = SMFIC_EOF;
89 return NULL;
90 }

--- 56 unchanged lines hidden (view full) ---

147 free(buf);
148 return NULL;
149 }
150 len = MI_SOCK_READ(sd, buf + i, expl - i);
151 if (MI_SOCK_READ_FAIL(len))
152 {
153 smi_log(SMI_LOG_ERR,
154 "%s: mi_rd_cmd: read returned %d: %s",
155 name, (int) len, sm_errstring(errno));
156 ret = -1;
157 break;
158 }
159 if (len == 0)
160 {
161 *cmd = SMFIC_EOF;
162 free(buf);
163 return NULL;

--- 47 unchanged lines hidden (view full) ---

211** len -- length of buffer (without cmd!)
212**
213** Returns:
214** MI_SUCCESS/MI_FAILURE
215*/
216
217/*
218** we don't care much about the timeout here, it's very long anyway
219** FD_SETSIZE is checked when socket is created.
220** XXX l == 0 ?
221*/
222
223#define MI_WR(data) \
224 while (sl > 0) \
225 { \
226 FD_ZERO(&wrtset); \
227 FD_SET((unsigned int) sd, &wrtset); \

--- 57 unchanged lines hidden ---