Skip to content
Snippets Groups Projects

Fix buffer size specification in function calls

Merged felixkhals requested to merge bugfix/buffer_length into master
1 file
+ 3
3
Compare changes
  • Side-by-side
  • Inline
@@ -138,15 +138,15 @@ static int getProcessAgentRank(uint32_t jobid, uint32_t vpid, size_t size) {
pid_t pid = getpid();
char info_to_send[BUFFLEN];
snprintf(info_to_send, BUFFLEN+1,
snprintf(info_to_send, BUFFLEN,
"%d,%u,%u,%zu",
pid, vpid, jobid, size);
if (send(socket_fd, info_to_send, BUFFLEN+1, 0) < 0) {
if (send(socket_fd, info_to_send, BUFFLEN, 0) < 0) {
errorExit("send");
}
char rank_to_recv[BUFFLEN];
recv(socket_fd, rank_to_recv, BUFFLEN+1, 0);
recv(socket_fd, rank_to_recv, BUFFLEN, 0);
int received_rank = (int)strtol(rank_to_recv, NULL, 0);
printf("Received from server: %d\n", received_rank);
Loading