Browse code

check return code from read

git-svn: trunk@4186

Tomasz Kojm authored on 2008/09/18 17:41:25
Showing 1 changed files
... ...
@@ -389,8 +389,7 @@ int reload_clamd_database(const struct optstruct *opt)
389 389
     }
390 390
 
391 391
     bread = read(sockd, buff, sizeof(buff) - 1);
392
-    buff[bread] = '\0';
393
-    if(strncmp(buff, "RELOADING", 9)) {
392
+    if(bread == -1 || strncmp(buff, "RELOADING", 9)) {
394 393
 	logg("!Incorrect reply from clamd\n");
395 394
 	close(sockd);
396 395
 	return 2;