This commit is contained in:
Afonso Franco 2024-05-12 23:46:41 +01:00
parent d482e0647f
commit 49fb1af798
Signed by: afonso
SSH key fingerprint: SHA256:PQTRDHPH3yALEGtHXnXBp3Orfcn21pK20t0tS1kHg54

View file

@ -32,7 +32,7 @@ int main() {
}
int send_fifo_fd;
send_fifo_fd = open(send_fifo_path, O_RDONLY);
send_fifo_fd = open(send_fifo_path, O_RDWR);
if (send_fifo_fd == -1) {
if (errno == ENOENT) {
// FIFO does not exist
@ -47,7 +47,9 @@ int main() {
while (1) {
// Read message from the send_fifo
unsigned char buffer[MESSAGE_SIZE];
read(send_fifo_fd, buffer, MESSAGE_SIZE);
if (read(send_fifo_fd, buffer, MESSAGE_SIZE) == 0) {
break;
}
// Deserialize the message
message msg;
deserialize_message(buffer, MESSAGE_SIZE, &msg);