Browse code

Better error handler

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

Nigel Horne authored on 2005/10/30 01:18:09
Showing 1 changed files
... ...
@@ -21,6 +21,9 @@
21 21
  *
22 22
  * Change History:
23 23
  * $Log: untar.c,v $
24
+ * Revision 1.28  2005/10/29 16:18:09  nigelhorne
25
+ * Better error handler
26
+ *
24 27
  * Revision 1.27  2005/09/01 21:03:46  nigelhorne
25 28
  * Added support for various GNU extensions
26 29
  *
... ...
@@ -103,7 +106,7 @@
103 103
  * First draft
104 104
  *
105 105
  */
106
-static	char	const	rcsid[] = "$Id: untar.c,v 1.27 2005/09/01 21:03:46 nigelhorne Exp $";
106
+static	char	const	rcsid[] = "$Id: untar.c,v 1.28 2005/10/29 16:18:09 nigelhorne Exp $";
107 107
 
108 108
 #include <stdio.h>
109 109
 #include <errno.h>
... ...
@@ -128,9 +131,10 @@ static	char	const	rcsid[] = "$Id: untar.c,v 1.27 2005/09/01 21:03:46 nigelhorne
128 128
 static int
129 129
 octal(const char *str)
130 130
 {
131
-	int ret = -1;
131
+	int ret;
132 132
 
133
-	(void)sscanf(str, "%o", (unsigned int *)&ret);
133
+	if(sscanf(str, "%o", (unsigned int *)&ret) != 1)
134
+		return -1;
134 135
 	return ret;
135 136
 }
136 137