fixed some little problems in commandline

This commit is contained in:
2022-08-30 16:50:17 +03:00
parent 6aec61d4a4
commit 1453398f08
19 changed files with 258 additions and 93 deletions

View File

@@ -53,12 +53,12 @@ message ServerMessages = {0};
*/
static size_t send_data(int sock, const char *textbuf){
ssize_t Len = strlen(textbuf);
if(Len != write(sock, textbuf, Len)){
if(Len != send(sock, textbuf, Len, MSG_NOSIGNAL)){
WARN("write()");
LOGERR("send_data(): write() failed");
return 0;
}else LOGDBG("send_data(): sent '%s'", textbuf);
if(textbuf[Len-1] != '\n') Len += write(sock, "\n", 1);
if(textbuf[Len-1] != '\n') Len += send(sock, "\n", 1, MSG_NOSIGNAL);
return (size_t)Len;
}