diff options
Diffstat (limited to 'tar.c')
-rw-r--r-- | tar.c | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -330,7 +330,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
330 | } | 330 | } |
331 | if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) { | 331 | if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) { |
332 | /* Tarball seems to have a problem */ | 332 | /* Tarball seems to have a problem */ |
333 | errorMsg("tar: Unexpected EOF in archive\n"); | 333 | errorMsg("Unexpected EOF in archive\n"); |
334 | return( FALSE); | 334 | return( FALSE); |
335 | } | 335 | } |
336 | if ( readSize < writeSize ) | 336 | if ( readSize < writeSize ) |
@@ -368,7 +368,7 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
368 | return( TRUE); | 368 | return( TRUE); |
369 | 369 | ||
370 | if (createPath(header->name, header->mode) != TRUE) { | 370 | if (createPath(header->name, header->mode) != TRUE) { |
371 | errorMsg("tar: %s: Cannot mkdir: %s\n", | 371 | errorMsg("%s: Cannot mkdir: %s\n", |
372 | header->name, strerror(errno)); | 372 | header->name, strerror(errno)); |
373 | return( FALSE); | 373 | return( FALSE); |
374 | } | 374 | } |
@@ -388,7 +388,7 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
388 | return( TRUE); | 388 | return( TRUE); |
389 | 389 | ||
390 | if (link(header->linkname, header->name) < 0) { | 390 | if (link(header->linkname, header->name) < 0) { |
391 | errorMsg("tar: %s: Cannot create hard link to '%s': %s\n", | 391 | errorMsg("%s: Cannot create hard link to '%s': %s\n", |
392 | header->name, header->linkname, strerror(errno)); | 392 | header->name, header->linkname, strerror(errno)); |
393 | return( FALSE); | 393 | return( FALSE); |
394 | } | 394 | } |
@@ -406,7 +406,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
406 | 406 | ||
407 | #ifdef S_ISLNK | 407 | #ifdef S_ISLNK |
408 | if (symlink(header->linkname, header->name) < 0) { | 408 | if (symlink(header->linkname, header->name) < 0) { |
409 | errorMsg("tar: %s: Cannot create symlink to '%s': %s\n", | 409 | errorMsg("%s: Cannot create symlink to '%s': %s\n", |
410 | header->name, header->linkname, strerror(errno)); | 410 | header->name, header->linkname, strerror(errno)); |
411 | return( FALSE); | 411 | return( FALSE); |
412 | } | 412 | } |
@@ -421,7 +421,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
421 | /* Do not change permissions or date on symlink, | 421 | /* Do not change permissions or date on symlink, |
422 | * since it changes the pointed to file instead. duh. */ | 422 | * since it changes the pointed to file instead. duh. */ |
423 | #else | 423 | #else |
424 | errorMsg("tar: %s: Cannot create symlink to '%s': %s\n", | 424 | errorMsg("%s: Cannot create symlink to '%s': %s\n", |
425 | header->name, header->linkname, | 425 | header->name, header->linkname, |
426 | "symlinks not supported"); | 426 | "symlinks not supported"); |
427 | #endif | 427 | #endif |
@@ -436,13 +436,13 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
436 | 436 | ||
437 | if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { | 437 | if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { |
438 | if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { | 438 | if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { |
439 | errorMsg("tar: %s: Cannot mknod: %s\n", | 439 | errorMsg("%s: Cannot mknod: %s\n", |
440 | header->name, strerror(errno)); | 440 | header->name, strerror(errno)); |
441 | return( FALSE); | 441 | return( FALSE); |
442 | } | 442 | } |
443 | } else if (S_ISFIFO(header->mode)) { | 443 | } else if (S_ISFIFO(header->mode)) { |
444 | if (mkfifo(header->name, header->mode) < 0) { | 444 | if (mkfifo(header->name, header->mode) < 0) { |
445 | errorMsg("tar: %s: Cannot mkfifo: %s\n", | 445 | errorMsg("%s: Cannot mkfifo: %s\n", |
446 | header->name, strerror(errno)); | 446 | header->name, strerror(errno)); |
447 | return( FALSE); | 447 | return( FALSE); |
448 | } | 448 | } |
@@ -490,7 +490,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header) | |||
490 | ++*(header->name); | 490 | ++*(header->name); |
491 | 491 | ||
492 | if (alreadyWarned == FALSE) { | 492 | if (alreadyWarned == FALSE) { |
493 | errorMsg("tar: Removing leading '/' from member names\n"); | 493 | errorMsg("Removing leading '/' from member names\n"); |
494 | alreadyWarned = TRUE; | 494 | alreadyWarned = TRUE; |
495 | } | 495 | } |
496 | } | 496 | } |
@@ -695,7 +695,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
695 | return ( FALSE); | 695 | return ( FALSE); |
696 | } | 696 | } |
697 | else if (errorFlag==TRUE) { | 697 | else if (errorFlag==TRUE) { |
698 | errorMsg( "tar: Error exit delayed from previous errors\n"); | 698 | errorMsg( "Error exit delayed from previous errors\n"); |
699 | return( FALSE); | 699 | return( FALSE); |
700 | } else | 700 | } else |
701 | return( status); | 701 | return( status); |
@@ -705,7 +705,7 @@ endgame: | |||
705 | close( tarFd); | 705 | close( tarFd); |
706 | if ( *(header.name) == '\0' ) { | 706 | if ( *(header.name) == '\0' ) { |
707 | if (errorFlag==TRUE) | 707 | if (errorFlag==TRUE) |
708 | errorMsg( "tar: Error exit delayed from previous errors\n"); | 708 | errorMsg( "Error exit delayed from previous errors\n"); |
709 | else | 709 | else |
710 | return( TRUE); | 710 | return( TRUE); |
711 | } | 711 | } |
@@ -782,7 +782,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
782 | if (*fileName=='/') { | 782 | if (*fileName=='/') { |
783 | static int alreadyWarned=FALSE; | 783 | static int alreadyWarned=FALSE; |
784 | if (alreadyWarned==FALSE) { | 784 | if (alreadyWarned==FALSE) { |
785 | errorMsg("tar: Removing leading '/' from member names\n"); | 785 | errorMsg("Removing leading '/' from member names\n"); |
786 | alreadyWarned=TRUE; | 786 | alreadyWarned=TRUE; |
787 | } | 787 | } |
788 | strncpy(header.name, fileName+1, sizeof(header.name)); | 788 | strncpy(header.name, fileName+1, sizeof(header.name)); |
@@ -854,7 +854,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
854 | header.typeflag = REGTYPE; | 854 | header.typeflag = REGTYPE; |
855 | putOctal(header.size, sizeof(header.size), statbuf->st_size); | 855 | putOctal(header.size, sizeof(header.size), statbuf->st_size); |
856 | } else { | 856 | } else { |
857 | errorMsg("tar: %s: Unknown file type\n", fileName); | 857 | errorMsg("%s: Unknown file type\n", fileName); |
858 | return ( FALSE); | 858 | return ( FALSE); |
859 | } | 859 | } |
860 | 860 | ||
@@ -892,7 +892,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
892 | 892 | ||
893 | /* It is against the rules to archive a socket */ | 893 | /* It is against the rules to archive a socket */ |
894 | if (S_ISSOCK(statbuf->st_mode)) { | 894 | if (S_ISSOCK(statbuf->st_mode)) { |
895 | errorMsg("tar: %s: socket ignored\n", fileName); | 895 | errorMsg("%s: socket ignored\n", fileName); |
896 | return( TRUE); | 896 | return( TRUE); |
897 | } | 897 | } |
898 | 898 | ||
@@ -901,7 +901,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
901 | * the new tarball */ | 901 | * the new tarball */ |
902 | if (tbInfo->statBuf.st_dev == statbuf->st_dev && | 902 | if (tbInfo->statBuf.st_dev == statbuf->st_dev && |
903 | tbInfo->statBuf.st_ino == statbuf->st_ino) { | 903 | tbInfo->statBuf.st_ino == statbuf->st_ino) { |
904 | errorMsg("tar: %s: file is the archive; skipping\n", fileName); | 904 | errorMsg("%s: file is the archive; skipping\n", fileName); |
905 | return( TRUE); | 905 | return( TRUE); |
906 | } | 906 | } |
907 | 907 | ||
@@ -917,7 +917,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
917 | 917 | ||
918 | /* open the file we want to archive, and make sure all is well */ | 918 | /* open the file we want to archive, and make sure all is well */ |
919 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { | 919 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { |
920 | errorMsg("tar: %s: Cannot open: %s\n", fileName, strerror(errno)); | 920 | errorMsg("%s: Cannot open: %s\n", fileName, strerror(errno)); |
921 | return( FALSE); | 921 | return( FALSE); |
922 | } | 922 | } |
923 | 923 | ||
@@ -955,7 +955,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag, | |||
955 | 955 | ||
956 | /* Make sure there is at least one file to tar up. */ | 956 | /* Make sure there is at least one file to tar up. */ |
957 | if (argc <= 0) | 957 | if (argc <= 0) |
958 | fatalError("tar: Cowardly refusing to create an empty archive\n"); | 958 | fatalError("Cowardly refusing to create an empty archive\n"); |
959 | 959 | ||
960 | /* Open the tar file for writing. */ | 960 | /* Open the tar file for writing. */ |
961 | if (tostdoutFlag == TRUE) | 961 | if (tostdoutFlag == TRUE) |
@@ -963,7 +963,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag, | |||
963 | else | 963 | else |
964 | tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); | 964 | tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); |
965 | if (tbInfo.tarFd < 0) { | 965 | if (tbInfo.tarFd < 0) { |
966 | errorMsg( "tar: Error opening '%s': %s\n", tarName, strerror(errno)); | 966 | errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno)); |
967 | return ( FALSE); | 967 | return ( FALSE); |
968 | } | 968 | } |
969 | tbInfo.excludeList=excludeList; | 969 | tbInfo.excludeList=excludeList; |
@@ -997,7 +997,7 @@ static int writeTarFile(const char* tarName, int tostdoutFlag, | |||
997 | /* Hang up the tools, close up shop, head home */ | 997 | /* Hang up the tools, close up shop, head home */ |
998 | close(tarFd); | 998 | close(tarFd); |
999 | if (errorFlag == TRUE) { | 999 | if (errorFlag == TRUE) { |
1000 | errorMsg("tar: Error exit delayed from previous errors\n"); | 1000 | errorMsg("Error exit delayed from previous errors\n"); |
1001 | return(FALSE); | 1001 | return(FALSE); |
1002 | } | 1002 | } |
1003 | return( TRUE); | 1003 | return( TRUE); |