aboutsummaryrefslogtreecommitdiff
path: root/tar.c
diff options
context:
space:
mode:
Diffstat (limited to 'tar.c')
-rw-r--r--tar.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/tar.c b/tar.c
index e1beee117..c6a2a6627 100644
--- a/tar.c
+++ b/tar.c
@@ -317,7 +317,7 @@ extern int tar_main(int argc, char **argv)
317 else 317 else
318 tarFd = open(tarName, O_RDONLY); 318 tarFd = open(tarName, O_RDONLY);
319 if (tarFd < 0) 319 if (tarFd < 0)
320 error_msg_and_die( "Error opening '%s': %s\n", tarName, strerror(errno)); 320 perror_msg_and_die("Error opening '%s'", tarName);
321 321
322#ifdef BB_FEATURE_TAR_GZIP 322#ifdef BB_FEATURE_TAR_GZIP
323 /* unzip tarFd in a seperate process */ 323 /* unzip tarFd in a seperate process */
@@ -425,8 +425,7 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag)
425 return( TRUE); 425 return( TRUE);
426 426
427 if (create_path(header->name, header->mode) != TRUE) { 427 if (create_path(header->name, header->mode) != TRUE) {
428 error_msg("%s: Cannot mkdir: %s\n", 428 perror_msg("%s: Cannot mkdir", header->name);
429 header->name, strerror(errno));
430 return( FALSE); 429 return( FALSE);
431 } 430 }
432 /* make the final component, just in case it was 431 /* make the final component, just in case it was
@@ -445,8 +444,8 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag)
445 return( TRUE); 444 return( TRUE);
446 445
447 if (link(header->linkname, header->name) < 0) { 446 if (link(header->linkname, header->name) < 0) {
448 error_msg("%s: Cannot create hard link to '%s': %s\n", 447 perror_msg("%s: Cannot create hard link to '%s'", header->name,
449 header->name, header->linkname, strerror(errno)); 448 header->linkname);
450 return( FALSE); 449 return( FALSE);
451 } 450 }
452 451
@@ -463,8 +462,8 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
463 462
464#ifdef S_ISLNK 463#ifdef S_ISLNK
465 if (symlink(header->linkname, header->name) < 0) { 464 if (symlink(header->linkname, header->name) < 0) {
466 error_msg("%s: Cannot create symlink to '%s': %s\n", 465 perror_msg("%s: Cannot create symlink to '%s'", header->name,
467 header->name, header->linkname, strerror(errno)); 466 header->linkname);
468 return( FALSE); 467 return( FALSE);
469 } 468 }
470 /* Try to change ownership of the symlink. 469 /* Try to change ownership of the symlink.
@@ -493,14 +492,12 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag)
493 492
494 if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { 493 if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) {
495 if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { 494 if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) {
496 error_msg("%s: Cannot mknod: %s\n", 495 perror_msg("%s: Cannot mknod", header->name);
497 header->name, strerror(errno));
498 return( FALSE); 496 return( FALSE);
499 } 497 }
500 } else if (S_ISFIFO(header->mode)) { 498 } else if (S_ISFIFO(header->mode)) {
501 if (mkfifo(header->name, header->mode) < 0) { 499 if (mkfifo(header->name, header->mode) < 0) {
502 error_msg("%s: Cannot mkfifo: %s\n", 500 perror_msg("%s: Cannot mkfifo", header->name);
503 header->name, strerror(errno));
504 return( FALSE); 501 return( FALSE);
505 } 502 }
506 } 503 }
@@ -790,7 +787,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag,
790 close(tarFd); 787 close(tarFd);
791 if (status > 0) { 788 if (status > 0) {
792 /* Bummer - we read a partial header */ 789 /* Bummer - we read a partial header */
793 error_msg( "Error reading tar file: %s\n", strerror(errno)); 790 perror_msg("Error reading tar file");
794 return ( FALSE); 791 return ( FALSE);
795 } 792 }
796 else if (errorFlag==TRUE) { 793 else if (errorFlag==TRUE) {
@@ -1007,7 +1004,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
1007 header.typeflag = SYMTYPE; 1004 header.typeflag = SYMTYPE;
1008 link_size = readlink(fileName, buffer, sizeof(buffer) - 1); 1005 link_size = readlink(fileName, buffer, sizeof(buffer) - 1);
1009 if ( link_size < 0) { 1006 if ( link_size < 0) {
1010 error_msg("Error reading symlink '%s': %s\n", header.name, strerror(errno)); 1007 perror_msg("Error reading symlink '%s'", header.name);
1011 return ( FALSE); 1008 return ( FALSE);
1012 } 1009 }
1013 buffer[link_size] = '\0'; 1010 buffer[link_size] = '\0';
@@ -1165,7 +1162,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
1165 else 1162 else
1166 tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); 1163 tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
1167 if (tbInfo.tarFd < 0) { 1164 if (tbInfo.tarFd < 0) {
1168 error_msg( "Error opening '%s': %s\n", tarName, strerror(errno)); 1165 perror_msg( "Error opening '%s'", tarName);
1169 freeHardLinkInfo(&tbInfo.hlInfoHead); 1166 freeHardLinkInfo(&tbInfo.hlInfoHead);
1170 return ( FALSE); 1167 return ( FALSE);
1171 } 1168 }