From 394631ddf3608723c52bfa26a0b6c702d9c2d963 Mon Sep 17 00:00:00 2001 From: riban Date: Sun, 7 Jul 2024 10:05:40 +0100 Subject: [PATCH 1/2] Fixes #73. Check if command response is for fd 1. --- src/protocol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol.h b/src/protocol.h index 346aa95..011ebda 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -57,7 +57,7 @@ #define MESSAGE_INVALID_ARGUMENT "invalid argument" // defines the function to send responses to sender -#define SEND_TO_SENDER(id,msg,len) socket_send((id),(msg),(len)+1) +#define SEND_TO_SENDER(id,msg,len) if(id==1)fprintf(stdin,"%s\n",msg); else socket_send((id),(msg),(len)+1) /* From 5cf025e46072bf820b1a28b3b90d3df90388b8e4 Mon Sep 17 00:00:00 2001 From: riban Date: Sun, 7 Jul 2024 16:04:39 +0100 Subject: [PATCH 2/2] Fixes stdout not stdin. --- src/protocol.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocol.h b/src/protocol.h index 011ebda..704858d 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -57,7 +57,7 @@ #define MESSAGE_INVALID_ARGUMENT "invalid argument" // defines the function to send responses to sender -#define SEND_TO_SENDER(id,msg,len) if(id==1)fprintf(stdin,"%s\n",msg); else socket_send((id),(msg),(len)+1) +#define SEND_TO_SENDER(id,msg,len) if(id==1)fprintf(stdout,"%s\n",msg); else socket_send((id),(msg),(len)+1) /*