git-svn: trunk@965
Nigel Horne authored on 2004/10/04 19:53:15... | ... |
@@ -20,6 +20,9 @@ |
20 | 20 |
* |
21 | 21 |
* Change History: |
22 | 22 |
* $Log: untar.c,v $ |
23 |
+ * Revision 1.12 2004/10/04 10:53:15 nigelhorne |
|
24 |
+ * Handle tar files less than 512 bytes |
|
25 |
+ * |
|
23 | 26 |
* Revision 1.11 2004/10/01 13:50:47 nigelhorne |
24 | 27 |
* Minor code tidy |
25 | 28 |
* |
... | ... |
@@ -54,7 +57,7 @@ |
54 | 54 |
* First draft |
55 | 55 |
* |
56 | 56 |
*/ |
57 |
-static char const rcsid[] = "$Id: untar.c,v 1.11 2004/10/01 13:50:47 nigelhorne Exp $"; |
|
57 |
+static char const rcsid[] = "$Id: untar.c,v 1.12 2004/10/04 10:53:15 nigelhorne Exp $"; |
|
58 | 58 |
|
59 | 59 |
#include <stdio.h> |
60 | 60 |
#include <errno.h> |
... | ... |
@@ -106,7 +109,7 @@ cli_untar(const char *dir, int desc) |
106 | 106 |
int size = 0; |
107 | 107 |
int in_block = 0; |
108 | 108 |
char fullname[NAME_MAX + 1]; |
109 |
- FILE *outfile = (FILE*)0; |
|
109 |
+ FILE *outfile = NULL; |
|
110 | 110 |
|
111 | 111 |
cli_dbgmsg("In untar(%s, %d)\n", dir ? dir : "", desc); |
112 | 112 |
|
... | ... |
@@ -117,10 +120,10 @@ cli_untar(const char *dir, int desc) |
117 | 117 |
if(!in_block && nread == 0) |
118 | 118 |
break; |
119 | 119 |
|
120 |
- if(nread != BLOCKSIZE) { |
|
120 |
+ if(nread < 0) { |
|
121 | 121 |
if(outfile) |
122 | 122 |
fclose(outfile); |
123 |
- cli_errmsg("cli_untar: incomplete block read\n"); |
|
123 |
+ cli_errmsg("cli_untar: block read error\n"); |
|
124 | 124 |
return CL_EIO; |
125 | 125 |
} |
126 | 126 |
|