This commit is contained in:
Andrew Pamment 2017-09-29 22:41:52 +10:00
parent 4a65bec2a5
commit 59bc08b24c

View File

@ -219,6 +219,11 @@ int main(int argc, char **argv) {
motd[strlen(motd) - 1] = '\0'; motd[strlen(motd) - 1] = '\0';
} }
if (strlen(motd) == 0) {
sprintf(motd, " ");
}
snprintf(buffer, 1024, "{\"bbs\": \"SYSTEM\", \"nick\": \"SYSTEM\", \"msg\": \"%s\" }", motd); snprintf(buffer, 1024, "{\"bbs\": \"SYSTEM\", \"nick\": \"SYSTEM\", \"msg\": \"%s\" }", motd);
if (send(clients[j]->fd, buffer, strlen(buffer) + 1, 0) == -1) { if (send(clients[j]->fd, buffer, strlen(buffer) + 1, 0) == -1) {
perror("send"); perror("send");