Browse code

cleanup

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

Tomasz Kojm authored on 2005/08/02 11:07:46
Showing 2 changed files
... ...
@@ -591,6 +591,7 @@ int cli_readn(int fd, void *buff, unsigned int count)
591 591
 			if (errno == EINTR) {
592 592
 				continue;
593 593
 			}
594
+			cli_errmsg("cli_writen: read error: %s\n", strerror(errno));
594 595
                         return -1;
595 596
                 }
596 597
                 todo -= retval;
... ...
@@ -604,15 +605,15 @@ int cli_readn(int fd, void *buff, unsigned int count)
604 604
 /* Function: writen
605 605
         Try hard to write the specified number of bytes
606 606
 */
607
-int cli_writen(int fd, void *buff, unsigned int count)
607
+int cli_writen(int fd, const void *buff, unsigned int count)
608 608
 {
609 609
         int retval;
610 610
         unsigned int todo;
611
-        unsigned char *current;
611
+        const unsigned char *current;
612 612
 
613 613
 
614 614
         todo = count;
615
-        current = (unsigned char *) buff;
615
+        current = (const unsigned char *) buff;
616 616
 
617 617
         do {
618 618
                 retval = write(fd, current, todo);
... ...
@@ -620,6 +621,7 @@ int cli_writen(int fd, void *buff, unsigned int count)
620 620
 			if (errno == EINTR) {
621 621
 				continue;
622 622
 			}
623
+			cli_errmsg("cli_writen: write error: %s\n", strerror(errno));
623 624
                         return -1;
624 625
                 }
625 626
                 todo -= retval;
... ...
@@ -34,7 +34,7 @@ unsigned char *cli_md5digest(int desc);
34 34
 char *cli_md5stream(FILE *fs, unsigned char *digcpy);
35 35
 char *cli_md5file(const char *filename);
36 36
 int cli_readn(int fd, void *buff, unsigned int count);
37
-int cli_writen(int fd, void *buff, unsigned int count);
37
+int cli_writen(int fd, const void *buff, unsigned int count);
38 38
 int32_t cli_readint32(const char *buff);
39 39
 void cli_writeint32(char *offset, uint32_t value);
40 40
 char *cli_gentemp(const char *dir);