samba-vscan/antivir vscan-antivir_core.c,1.1.2.3,1.1.2.4

Rainer Link <[email protected]> Wed, 12 Apr 2006 08:52:54 +0000
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/samba-vscan/antivir
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18289/antivir

Modified Files:
      Tag: VSCAN_0_3
	vscan-antivir_core.c 
Log Message:
bugfix to avoid connection issues, if the startup of the antivir server
takes a little bit longer than expect. Provided by Avira


Index: vscan-antivir_core.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/antivir/Attic/vscan-antivir_core.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- vscan-antivir_core.c	18 Jan 2005 20:03:14 -0000	1.1.2.3
+++ vscan-antivir_core.c	12 Apr 2006 08:52:52 -0000	1.1.2.4
@@ -194,11 +194,17 @@
 	request = NULL;
 
 	/* get response (in a loop, we might have to skip some lines) */
-	do {
+	while (1) {
+		/* get another input line */
 		memset(buff, 0, sizeof(buff));
 		p1 = fgets((char *)&buff, sizeof(buff), antivir_file_read);
-		if (p1 == NULL)
-			break;
+		if (p1 == NULL) {
+			/* read error or EOF, close the scanner process */
+			disconnect_from_scanner();
+			vscan_syslog("ERROR: can not get result from antivir");
+			return VSCAN_SCAN_ERROR;
+		}
+
 		/* remove trailing spaces */
 		p1 = buff + strlen(buff);
 		while ((p1 > buff) && (isspace((int)*(p1-1)))) {
@@ -250,12 +256,8 @@
 			/* FIXME: should this really reported as minor error? */
 			return VSCAN_SCAN_MINOR_ERROR;
 		}
-	} while (0);
-
-	/* read error or EOF, close the scanner process */
-	disconnect_from_scanner();
-
-	vscan_syslog("ERROR: can not get result from antivir");
+	}
+	/* UNREACH */
 	return VSCAN_SCAN_ERROR;
 }
 



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642