last_net_seq_num);
/* Avoid wrapping issue */
- if (((int64_t) (stream->prev_seq - last_net_seq_num)) <= 0) {
+ if (((int64_t) (stream->prev_seq - last_net_seq_num)) >= 0) {
/* Data has in fact been written and is NOT pending */
ret = 0;
} else {
PERROR("Relay command zmalloc");
goto error;
}
- ret = read(fd, relay_connection, sizeof(struct relay_command));
+ do {
+ ret = read(fd, relay_connection, sizeof(struct relay_command));
+ } while (ret < 0 && errno == EINTR);
if (ret < 0 || ret < sizeof(struct relay_command)) {
PERROR("read relay cmd pipe");
goto error_read;