return FALSE;
#if defined __MINGW32__
- if (mkdir(path) < 0)
+ if (mkdir(path) < 0) { /* try again */
error("Cannot make directory", path);
return FALSE;
+ }
#else
if (mkdir(path, 0777) < 0) { /* try again */
error("Cannot make directory", path);
char *name;
LzHeader *hdr;
{
- time_t utimebuf[2];
+ struct utimbuf utimebuf;
/* adjust file stamp */
- utimebuf[0] = utimebuf[1] = hdr->unix_last_modified_stamp;
+ utimebuf.actime = utimebuf.modtime = hdr->unix_last_modified_stamp;
if ((hdr->unix_mode & UNIX_FILE_TYPEMASK) != UNIX_FILE_SYMLINK)
- utime(name, utimebuf);
+ utime(name, &utimebuf);
if (hdr->extend_type == EXTEND_UNIX
|| hdr->extend_type == EXTEND_OS68K
{
FILE *fp; /* output file */
struct stat stbuf;
- char name[257];
+ char name[FILENAME_LENGTH];
int crc;
int method;
boolean save_quiet, save_verbose, up_flag;
5, hdr->method, name);
return;
}
- if (bcmp(hdr->method, methods[method], 5) == 0)
+ if (memcmp(hdr->method, methods[method], 5) == 0)
break;
}
if (methods[method] == NULL) {
error("Unknown method \"%.*s\"; \"%s\" will be skiped ...",
5, hdr->method, name);
+ return;
}
- if (bcmp(hdr->method, methods[method], 5) == 0)
+ if (memcmp(hdr->method, methods[method], 5) == 0)
break;
}
#endif
reading_filename = archive_name;
- writting_filename = name;
+ writing_filename = name;
if (output_to_stdout || verify_mode) {
if (noexec) {
printf("%s %s\n", verify_mode ? "VERIFY" : "EXTRACT", name);
else if ((hdr->unix_mode & UNIX_FILE_TYPEMASK) == UNIX_FILE_DIRECTORY
|| (hdr->unix_mode & UNIX_FILE_TYPEMASK) == UNIX_FILE_SYMLINK
|| method == LZHDIRS_METHOD_NUM) {
- /* ¢¬¤³¤ì¤Ç¡¢Symblic Link ¤Ï¡¢Âç¾æÉפ«¡© */
+ /* ¢¬¤³¤ì¤Ç¡¢Symbolic Link ¤Ï¡¢Âç¾æÉפ«¡© */
if (!ignore_directory && !verify_mode) {
if (noexec) {
if (quiet != TRUE)
if (need_file(hdr.name)) {
pos = ftell(afp);
extract_one(afp, &hdr);
-#if 0 /* On MinGW, if afp == stdin, fseek() will succeed.
- but next getc(afp) return EOF */
- fseek(afp, pos + hdr.packed_size, SEEK_SET);
-#endif
+ /* when error occurred in extract_one(), should adjust
+ point of file stream */
+ if (afp != stdin)
+ fseek(afp, pos + hdr.packed_size, SEEK_SET);
+ else {
+ /* FIXME: assume that the extract_one() has read
+ packed_size bytes from stdin. */
+ long i = 0;
+ while (i--) fgetc(afp);
+ }
} else {
if (afp != stdin)
fseek(afp, hdr.packed_size, SEEK_CUR);