Update return code (and errno) of mud_send()
This commit is contained in:
11
mud.c
11
mud.c
@@ -1185,21 +1185,18 @@ int mud_send (struct mud *mud, const void *data, size_t size, int tc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!path_min)
|
if (!path_min)
|
||||||
return -1;
|
return 0;
|
||||||
|
|
||||||
unsigned char packet[2048];
|
unsigned char packet[2048];
|
||||||
|
|
||||||
int packet_size = mud_encrypt(mud, now,
|
int packet_size = mud_encrypt(mud, now, packet, sizeof(packet), data, size);
|
||||||
packet, sizeof(packet),
|
|
||||||
data, size);
|
|
||||||
|
|
||||||
if (!packet_size) {
|
if (!packet_size) {
|
||||||
errno = EMSGSIZE;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t ret = mud_send_path(mud, path_min, now,
|
ssize_t ret = mud_send_path(mud, path_min, now, packet, packet_size, tc);
|
||||||
packet, packet_size, tc);
|
|
||||||
|
|
||||||
if (ret == packet_size)
|
if (ret == packet_size)
|
||||||
path_min->limit = limit_min;
|
path_min->limit = limit_min;
|
||||||
|
|||||||
Reference in New Issue
Block a user