git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@835 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/09/06 23:16:48... | ... |
@@ -20,6 +20,9 @@ |
20 | 20 |
* |
21 | 21 |
* Change History: |
22 | 22 |
* $Log: untar.c,v $ |
23 |
+ * Revision 1.5 2004/09/06 14:16:48 nigelhorne |
|
24 |
+ * Added CYGWIN support |
|
25 |
+ * |
|
23 | 26 |
* Revision 1.4 2004/09/06 08:45:44 nigelhorne |
24 | 27 |
* Code Tidy |
25 | 28 |
* |
... | ... |
@@ -33,7 +36,7 @@ |
33 | 33 |
* First draft |
34 | 34 |
* |
35 | 35 |
*/ |
36 |
-static char const rcsid[] = "$Id: untar.c,v 1.4 2004/09/06 08:45:44 nigelhorne Exp $"; |
|
36 |
+static char const rcsid[] = "$Id: untar.c,v 1.5 2004/09/06 14:16:48 nigelhorne Exp $"; |
|
37 | 37 |
|
38 | 38 |
#include <stdio.h> |
39 | 39 |
#include <errno.h> |
... | ... |
@@ -50,6 +53,20 @@ static char const rcsid[] = "$Id: untar.c,v 1.4 2004/09/06 08:45:44 nigelhorne E |
50 | 50 |
|
51 | 51 |
#define BLOCKSIZE 512 |
52 | 52 |
|
53 |
+/* Maximum filenames under various systems */ |
|
54 |
+#ifndef NAME_MAX /* e.g. Linux */ |
|
55 |
+ |
|
56 |
+#ifdef MAXNAMELEN /* e.g. Solaris */ |
|
57 |
+#define NAME_MAX MAXNAMELEN |
|
58 |
+#else |
|
59 |
+ |
|
60 |
+#ifdef FILENAME_MAX /* e.g. SCO */ |
|
61 |
+#define NAME_MAX FILENAME_MAX |
|
62 |
+#endif |
|
63 |
+ |
|
64 |
+#endif |
|
65 |
+ |
|
66 |
+#endif |
|
53 | 67 |
static int |
54 | 68 |
octal(const char *str) |
55 | 69 |
{ |
... | ... |
@@ -71,7 +88,7 @@ cli_untar(const char *dir, int desc) |
71 | 71 |
|
72 | 72 |
for(;;) { |
73 | 73 |
char block[BLOCKSIZE]; |
74 |
- const int nread = read(desc, block, sizeof(block)); |
|
74 |
+ const int nread = cli_readn(desc, block, sizeof(block)); |
|
75 | 75 |
|
76 | 76 |
if(!in_block && nread == 0) |
77 | 77 |
break; |