commit 36117373aad62990851aa26d1e6381c12e767166
parent 56c4cd47a74e99f6a794b6f37ae2a3092af3b592
Author: Claudio Alessi <smoppy@gmail.com>
Date: Sat, 21 Apr 2018 14:33:55 +0200
Check for empty host or port.
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/circo.c b/circo.c
@@ -337,9 +337,12 @@ cmd_server(char *cmd, char *s) {
sout("QUIT");
hangsup();
}
- if((fd = dial(host, port)) < 0) {
+ if(!*host)
+ bprintf(status, "No host specified.\n");
+ else if(!*port)
+ bprintf(status, "No port specified.\n");
+ else if((fd = dial(host, port)) < 0)
bprintf(status, "Cannot connect to %s on port %s\n", host, port);
- }
else {
srv = fdopen(fd, "r+");
printf(TTLSET, host);