version 1.2, 2004/07/25 03:21:11 |
version 1.3, 2004/09/25 12:22:54 |
|
|
* in the <dst> buffer. The <len> parameter should contain the maximum |
* in the <dst> buffer. The <len> parameter should contain the maximum |
* length of data that can be stored in <dst>, and will contain the actual |
* length of data that can be stored in <dst>, and will contain the actual |
* size of data stored on return. The message type is stored in <type>. |
* size of data stored on return. The message type is stored in <type>. |
* Returns 0 on success, or -1 on failure. |
* Returns 1 if a message was read, 0 if the remote end closed the message |
|
* socket and no further messages can be read, or -1 on failure. |
*/ |
*/ |
|
|
int |
int |
|
|
ssize_t ret; |
ssize_t ret; |
struct cvsd_msg msg; |
struct cvsd_msg msg; |
|
|
if (read(fd, &msg, sizeof(msg)) == -1) { |
if ((ret = read(fd, &msg, sizeof(msg))) == -1) { |
cvs_log(LP_ERRNO, "failed to read message header"); |
cvs_log(LP_ERRNO, "failed to read message header"); |
return (-1); |
return (-1); |
} |
} |
|
else if (ret == 0) |
|
return (0); |
|
|
if (*len < msg.cm_len) { |
if (*len < msg.cm_len) { |
cvs_log(LP_ERR, "buffer size too small for message data"); |
cvs_log(LP_ERR, "buffer size too small for message data"); |