OSDN Git Service

* src/lhext.c: replaced bcmp() with memcmp().
[lha/lha.git] / src / lhext.c
index 2fdc2ed..6542166 100644 (file)
@@ -240,7 +240,7 @@ extract_one(afp, hdr)
                   5, hdr->method, name);
                        return;
                }
-               if (bcmp(hdr->method, methods[method], 5) == 0)
+               if (memcmp(hdr->method, methods[method], 5) == 0)
                        break;
        }
 
@@ -251,8 +251,9 @@ extract_one(afp, hdr)
                        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
@@ -353,7 +354,7 @@ extract_one(afp, hdr)
        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)
@@ -440,9 +441,10 @@ cmd_extract()
                        if (afp != stdin)
                 fseek(afp, pos + hdr.packed_size, SEEK_SET);
             else {
-                long pos2 = ftell(afp);
-                int i = pos + hdr.packed_size - pos2;
-                               while (i-- > 0) fgetc(afp);
+                /* FIXME: assume that the extract_one() has read
+                   packed_size bytes from stdin. */
+                long i = 0;
+                               while (i--) fgetc(afp);
             }
                } else {
                        if (afp != stdin)