version 1.4, 2009/07/23 20:24:27 |
version 1.5, 2009/07/26 12:58:44 |
|
|
int |
int |
client_msg_fn_error(struct hdr *hdr, struct client_ctx *cctx) |
client_msg_fn_error(struct hdr *hdr, struct client_ctx *cctx) |
{ |
{ |
char *errstr; |
struct msg_print_data data; |
|
|
if (hdr->size == SIZE_MAX) |
if (hdr->size < sizeof data) |
fatalx("bad MSG_ERROR size"); |
fatalx("bad MSG_PRINT size"); |
|
buffer_read(cctx->srv_in, &data, sizeof data); |
|
|
errstr = xmalloc(hdr->size + 1); |
data.msg[(sizeof data.msg) - 1] = '\0'; |
buffer_read(cctx->srv_in, errstr, hdr->size); |
cctx->errstr = xstrdup(data.msg); |
errstr[hdr->size] = '\0'; |
|
|
|
cctx->errstr = errstr; |
|
return (-1); |
return (-1); |
} |
} |
|
|