Browse code

check return code from fstat(). If less than 0, log error message and return error to caller, bb#5778

Steve Morgan authored on 2012/09/18 04:47:47
Showing 1 changed files
... ...
@@ -257,7 +257,11 @@ int client(const struct optstruct *opts, int *infected, int *err)
257 257
     if(scandash) {
258 258
 	int sockd, ret;
259 259
 	STATBUF sb;
260
-	FSTAT(0, &sb);
260
+	if(FSTAT(0, &sb) < 0) {
261
+	    logg("client.c: fstat failed for file name \"%s\", with %s\n.", 
262
+		 opts->filename[0], strerror(errno));
263
+	    return 2;
264
+	}
261 265
 	if((sb.st_mode & S_IFMT) != S_IFREG) scantype = STREAM;
262 266
 	if((sockd = dconnect()) >= 0 && (ret = dsresult(sockd, scantype, NULL, &ret, NULL)) >= 0)
263 267
 	    *infected = ret;