Browse code

update

git-svn: trunk@1610

Tomasz Kojm authored on 2005/06/12 05:27:59
Showing 1 changed files
... ...
@@ -715,15 +715,21 @@ static int cli_scanbzip(int desc, const char **virname, long int *scanned, const
715 715
 
716 716
 static int cli_scanszdd(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, unsigned int arec, unsigned int mrec)
717 717
 {
718
-	int fd, ret = CL_CLEAN;
718
+	int fd, ret = CL_CLEAN, dcpy;
719 719
 	FILE *tmp = NULL, *in;
720 720
 	char *tmpname;
721 721
 
722 722
 
723
-    cli_dbgmsg("in cli_scanmscomp()\n");
723
+    cli_dbgmsg("in cli_scanszdd()\n");
724
+
725
+    if((dcpy = dup(desc)) == -1) {
726
+	cli_dbgmsg("SZDD: Can't duplicate descriptor %d\n", desc);
727
+	return CL_EIO;
728
+    }
724 729
 
725
-    if((in = fdopen(dup(desc), "rb")) == NULL) {
730
+    if((in = fdopen(dcpy, "rb")) == NULL) {
726 731
 	cli_dbgmsg("SZDD: Can't open descriptor %d\n", desc);
732
+	close(dcpy);
727 733
 	return CL_EMSCOMP;
728 734
     }
729 735