mirror of
https://github.com/sheumann/hush.git
synced 2025-01-06 21:30:08 +00:00
Dont strip trailing '/' until _after_ i test to set if its there !
This commit is contained in:
parent
7b565a0c8a
commit
6aa52234e8
@ -12,6 +12,10 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* FIXME: Better checking required in oldcompatability mode,
|
||||
* the file db.1.85.tar.gz from sleepycat.com has trailing garbage
|
||||
* GNU tar can handle it, busybox tar reports invalid tar header.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -106,14 +110,6 @@ extern char get_header_tar(archive_handle_t *archive_handle)
|
||||
file_header->name = concat_path_file(tar.formated.prefix, tar.formated.name);
|
||||
}
|
||||
|
||||
{ /* Strip trailing '/' in directories */
|
||||
char *tmp = last_char_is(file_header->name, '/');
|
||||
if (tmp) {
|
||||
*tmp = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
file_header->mode = strtol(tar.formated.mode, NULL, 8);
|
||||
file_header->uid = strtol(tar.formated.uid, NULL, 8);
|
||||
file_header->gid = strtol(tar.formated.gid, NULL, 8);
|
||||
@ -130,8 +126,10 @@ extern char get_header_tar(archive_handle_t *archive_handle)
|
||||
case 0:
|
||||
case '0':
|
||||
if (last_char_is(file_header->name, '/')) {
|
||||
printf("directory\n");
|
||||
file_header->mode |= S_IFDIR;
|
||||
} else {
|
||||
printf("regular file\n");
|
||||
file_header->mode |= S_IFREG;
|
||||
}
|
||||
break;
|
||||
@ -181,6 +179,13 @@ extern char get_header_tar(archive_handle_t *archive_handle)
|
||||
bb_error_msg("Ignoring GNU extension type %c", tar.formated.typeflag);
|
||||
#endif
|
||||
}
|
||||
{ /* Strip trailing '/' in directories */
|
||||
/* Must be done after mode is set as '/' is used to check if its a directory */
|
||||
char *tmp = last_char_is(file_header->name, '/');
|
||||
if (tmp) {
|
||||
*tmp = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) {
|
||||
archive_handle->action_header(archive_handle->file_header);
|
||||
|
Loading…
Reference in New Issue
Block a user