Browse code

Use cli_writen()

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@443 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2004/03/27 00:31:01
Showing 3 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Mar 26 16:22:45 CET 2004 (tk)
2
+---------------------------------
3
+  * libclamav: scanners: use cli_writen()
4
+
1 5
 Fri Mar 26 11:32:08 GMT 2004 (trog)
2 6
 -----------------------------------
3 7
   * libclamav: check for EINTR in cli_readn/cli_writen
... ...
@@ -8,6 +12,7 @@ Fri Mar 26 11:21:34 GMT 2004 (njh)
8 8
   * clamav-milter:	Added some debug information to clamd_send()
9 9
 
10 10
 Fri Mar 26 09:47:50 GMT 2004 (trog)
11
+-----------------------------------
11 12
   * libclamav: Remove duplicate code. Fix memory leak.
12 13
 
13 14
 Thu Mar 25 22:51:53 GMT 2004 (njh)
... ...
@@ -369,10 +369,11 @@ int cli_readn(int fd, void *buff, unsigned int count)
369 369
         int retval;
370 370
         unsigned int todo;
371 371
         unsigned char *current;
372
-                                                                                                                                    
372
+
373
+
373 374
         todo = count;
374 375
         current = (unsigned char *) buff;
375
-                                                                                                                                    
376
+
376 377
         do {
377 378
                 retval = read(fd, current, todo);
378 379
                 if (retval == 0) {
... ...
@@ -387,10 +388,11 @@ int cli_readn(int fd, void *buff, unsigned int count)
387 387
                 todo -= retval;
388 388
                 current += retval;
389 389
         } while (todo > 0);
390
-                                                                                                                                    
390
+
391
+
391 392
         return count;
392 393
 }
393
-                                                                                                                                    
394
+
394 395
 /* Function: writen
395 396
         Try hard to write the specified number of bytes
396 397
 */
... ...
@@ -399,10 +401,11 @@ int cli_writen(int fd, void *buff, unsigned int count)
399 399
         int retval;
400 400
         unsigned int todo;
401 401
         unsigned char *current;
402
-                                                                                                                                    
402
+
403
+
403 404
         todo = count;
404 405
         current = (unsigned char *) buff;
405
-                                                                                                                                    
406
+
406 407
         do {
407 408
                 retval = write(fd, current, todo);
408 409
                 if (retval < 0) {
... ...
@@ -414,7 +417,8 @@ int cli_writen(int fd, void *buff, unsigned int count)
414 414
                 todo -= retval;
415 415
                 current += retval;
416 416
         } while (todo > 0);
417
-                                                                                                                                    
417
+
418
+
418 419
         return count;
419 420
 }
420 421
 
... ...
@@ -492,7 +492,7 @@ static int cli_scangzip(int desc, const char **virname, long int *scanned, const
492 492
 		break;
493 493
 	    }
494 494
 
495
-	if(write(fd, buff, bytes) != bytes) {
495
+	if(cli_writen(fd, buff, bytes) != bytes) {
496 496
 	    cli_dbgmsg("Gzip -> Can't write() file.\n");
497 497
 	    fclose(tmp);
498 498
 	    gzclose(gd);
... ...
@@ -580,7 +580,7 @@ static int cli_scanbzip(int desc, const char **virname, long int *scanned, const
580 580
 		break;
581 581
 	    }
582 582
 
583
-	if(write(fd, buff, bytes) != bytes) {
583
+	if(cli_writen(fd, buff, bytes) != bytes) {
584 584
 	    cli_dbgmsg("Bzip2 -> Can't write() file.\n");
585 585
 	    BZ2_bzReadClose(&bzerror, bfd);
586 586
 	    fclose(tmp);