From cc370cedbf4d15a7e4bd7a089840e088e2b7345c Mon Sep 17 00:00:00 2001 From: Renge Date: Fri, 6 May 2022 14:23:46 -0400 Subject: [PATCH] fix: fflush --- hw5/src/tu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw5/src/tu.c b/hw5/src/tu.c index 527a0dd..846ebc8 100644 --- a/hw5/src/tu.c +++ b/hw5/src/tu.c @@ -521,7 +521,7 @@ int tu_chat(TU *tu, char *msg) { { debug("sending msg"); int status = 0; - if (fprintf(target->f, "CHAT %s\r\n", msg) < 0 && fflush(target->f) < 0) + if (fprintf(target->f, "CHAT %s\r\n", msg) < 0 || fflush(target->f) < 0) status = -1; if (tu_notify(tu) < 0) status = -1;