diff options
Diffstat (limited to 'archival/tar.c')
-rw-r--r-- | archival/tar.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/archival/tar.c b/archival/tar.c index 906fd7eda..cc7ba3b80 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -193,10 +193,10 @@ extern int tar_main(int argc, char **argv) | |||
193 | break; | 193 | break; |
194 | case 'f': | 194 | case 'f': |
195 | if (*tarName != '-') | 195 | if (*tarName != '-') |
196 | fatalError( "Only one 'f' option allowed\n"); | 196 | error_msg_and_die( "Only one 'f' option allowed\n"); |
197 | tarName = *(++argv); | 197 | tarName = *(++argv); |
198 | if (tarName == NULL) | 198 | if (tarName == NULL) |
199 | fatalError( "Option requires an argument: No file specified\n"); | 199 | error_msg_and_die( "Option requires an argument: No file specified\n"); |
200 | stopIt=TRUE; | 200 | stopIt=TRUE; |
201 | break; | 201 | break; |
202 | #if defined BB_FEATURE_TAR_EXCLUDE | 202 | #if defined BB_FEATURE_TAR_EXCLUDE |
@@ -205,7 +205,7 @@ extern int tar_main(int argc, char **argv) | |||
205 | excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); | 205 | excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); |
206 | excludeList[excludeListSize] = *(++argv); | 206 | excludeList[excludeListSize] = *(++argv); |
207 | if (excludeList[excludeListSize] == NULL) | 207 | if (excludeList[excludeListSize] == NULL) |
208 | fatalError( "Option requires an argument: No file specified\n"); | 208 | error_msg_and_die( "Option requires an argument: No file specified\n"); |
209 | /* Remove leading "/"s */ | 209 | /* Remove leading "/"s */ |
210 | if (*excludeList[excludeListSize] =='/') | 210 | if (*excludeList[excludeListSize] =='/') |
211 | excludeList[excludeListSize] = (excludeList[excludeListSize])+1; | 211 | excludeList[excludeListSize] = (excludeList[excludeListSize])+1; |
@@ -216,13 +216,13 @@ extern int tar_main(int argc, char **argv) | |||
216 | } | 216 | } |
217 | case 'X': | 217 | case 'X': |
218 | if (*excludeFileName != '-') | 218 | if (*excludeFileName != '-') |
219 | fatalError("Only one 'X' option allowed\n"); | 219 | error_msg_and_die("Only one 'X' option allowed\n"); |
220 | excludeFileName = *(++argv); | 220 | excludeFileName = *(++argv); |
221 | if (excludeFileName == NULL) | 221 | if (excludeFileName == NULL) |
222 | fatalError("Option requires an argument: No file specified\n"); | 222 | error_msg_and_die("Option requires an argument: No file specified\n"); |
223 | fileList = fopen (excludeFileName, "rt"); | 223 | fileList = fopen (excludeFileName, "rt"); |
224 | if (! fileList) | 224 | if (! fileList) |
225 | fatalError("Exclude file: file not found\n"); | 225 | error_msg_and_die("Exclude file: file not found\n"); |
226 | while (!feof(fileList)) { | 226 | while (!feof(fileList)) { |
227 | fscanf(fileList, "%s", file); | 227 | fscanf(fileList, "%s", file); |
228 | excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); | 228 | excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); |
@@ -253,7 +253,7 @@ extern int tar_main(int argc, char **argv) | |||
253 | */ | 253 | */ |
254 | if (createFlag == TRUE) { | 254 | if (createFlag == TRUE) { |
255 | #ifndef BB_FEATURE_TAR_CREATE | 255 | #ifndef BB_FEATURE_TAR_CREATE |
256 | fatalError( "This version of tar was not compiled with tar creation support.\n"); | 256 | error_msg_and_die( "This version of tar was not compiled with tar creation support.\n"); |
257 | #else | 257 | #else |
258 | status = writeTarFile(tarName, verboseFlag, argv, excludeList); | 258 | status = writeTarFile(tarName, verboseFlag, argv, excludeList); |
259 | #endif | 259 | #endif |
@@ -271,7 +271,7 @@ extern int tar_main(int argc, char **argv) | |||
271 | return EXIT_FAILURE; | 271 | return EXIT_FAILURE; |
272 | 272 | ||
273 | flagError: | 273 | flagError: |
274 | fatalError( "Exactly one of 'c', 'x' or 't' must be specified\n"); | 274 | error_msg_and_die( "Exactly one of 'c', 'x' or 't' must be specified\n"); |
275 | } | 275 | } |
276 | 276 | ||
277 | static void | 277 | static void |
@@ -301,10 +301,10 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
301 | if (extractFlag==TRUE && tostdoutFlag==FALSE) { | 301 | if (extractFlag==TRUE && tostdoutFlag==FALSE) { |
302 | /* Create the path to the file, just in case it isn't there... | 302 | /* Create the path to the file, just in case it isn't there... |
303 | * This should not screw up path permissions or anything. */ | 303 | * This should not screw up path permissions or anything. */ |
304 | createPath(header->name, 0777); | 304 | create_path(header->name, 0777); |
305 | if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, | 305 | if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, |
306 | header->mode & ~S_IFMT)) < 0) { | 306 | header->mode & ~S_IFMT)) < 0) { |
307 | errorMsg(io_error, header->name, strerror(errno)); | 307 | error_msg(io_error, header->name, strerror(errno)); |
308 | return( FALSE); | 308 | return( FALSE); |
309 | } | 309 | } |
310 | } | 310 | } |
@@ -322,9 +322,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
322 | readSize = size; | 322 | readSize = size; |
323 | writeSize = size; | 323 | writeSize = size; |
324 | } | 324 | } |
325 | if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) { | 325 | if ( (readSize = full_read(header->tarFd, buffer, readSize)) <= 0 ) { |
326 | /* Tarball seems to have a problem */ | 326 | /* Tarball seems to have a problem */ |
327 | errorMsg("Unexpected EOF in archive\n"); | 327 | error_msg("Unexpected EOF in archive\n"); |
328 | return( FALSE); | 328 | return( FALSE); |
329 | } | 329 | } |
330 | if ( readSize < writeSize ) | 330 | if ( readSize < writeSize ) |
@@ -333,9 +333,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
333 | /* Write out the file, if we are supposed to be doing that */ | 333 | /* Write out the file, if we are supposed to be doing that */ |
334 | if (extractFlag==TRUE) { | 334 | if (extractFlag==TRUE) { |
335 | 335 | ||
336 | if ((actualWriteSz=fullWrite(outFd, buffer, writeSize)) != writeSize ) { | 336 | if ((actualWriteSz=full_write(outFd, buffer, writeSize)) != writeSize ) { |
337 | /* Output file seems to have a problem */ | 337 | /* Output file seems to have a problem */ |
338 | errorMsg(io_error, header->name, strerror(errno)); | 338 | error_msg(io_error, header->name, strerror(errno)); |
339 | return( FALSE); | 339 | return( FALSE); |
340 | } | 340 | } |
341 | } else { | 341 | } else { |
@@ -361,13 +361,13 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
361 | if (extractFlag==FALSE || tostdoutFlag==TRUE) | 361 | if (extractFlag==FALSE || tostdoutFlag==TRUE) |
362 | return( TRUE); | 362 | return( TRUE); |
363 | 363 | ||
364 | if (createPath(header->name, header->mode) != TRUE) { | 364 | if (create_path(header->name, header->mode) != TRUE) { |
365 | errorMsg("%s: Cannot mkdir: %s\n", | 365 | error_msg("%s: Cannot mkdir: %s\n", |
366 | header->name, strerror(errno)); | 366 | header->name, strerror(errno)); |
367 | return( FALSE); | 367 | return( FALSE); |
368 | } | 368 | } |
369 | /* make the final component, just in case it was | 369 | /* make the final component, just in case it was |
370 | * omitted by createPath() (which will skip the | 370 | * omitted by create_path() (which will skip the |
371 | * directory if it doesn't have a terminating '/') */ | 371 | * directory if it doesn't have a terminating '/') */ |
372 | if (mkdir(header->name, header->mode) == 0) { | 372 | if (mkdir(header->name, header->mode) == 0) { |
373 | fixUpPermissions(header); | 373 | fixUpPermissions(header); |
@@ -382,7 +382,7 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
382 | return( TRUE); | 382 | return( TRUE); |
383 | 383 | ||
384 | if (link(header->linkname, header->name) < 0) { | 384 | if (link(header->linkname, header->name) < 0) { |
385 | errorMsg("%s: Cannot create hard link to '%s': %s\n", | 385 | error_msg("%s: Cannot create hard link to '%s': %s\n", |
386 | header->name, header->linkname, strerror(errno)); | 386 | header->name, header->linkname, strerror(errno)); |
387 | return( FALSE); | 387 | return( FALSE); |
388 | } | 388 | } |
@@ -400,7 +400,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
400 | 400 | ||
401 | #ifdef S_ISLNK | 401 | #ifdef S_ISLNK |
402 | if (symlink(header->linkname, header->name) < 0) { | 402 | if (symlink(header->linkname, header->name) < 0) { |
403 | errorMsg("%s: Cannot create symlink to '%s': %s\n", | 403 | error_msg("%s: Cannot create symlink to '%s': %s\n", |
404 | header->name, header->linkname, strerror(errno)); | 404 | header->name, header->linkname, strerror(errno)); |
405 | return( FALSE); | 405 | return( FALSE); |
406 | } | 406 | } |
@@ -415,7 +415,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
415 | /* Do not change permissions or date on symlink, | 415 | /* Do not change permissions or date on symlink, |
416 | * since it changes the pointed to file instead. duh. */ | 416 | * since it changes the pointed to file instead. duh. */ |
417 | #else | 417 | #else |
418 | errorMsg("%s: Cannot create symlink to '%s': %s\n", | 418 | error_msg("%s: Cannot create symlink to '%s': %s\n", |
419 | header->name, header->linkname, | 419 | header->name, header->linkname, |
420 | "symlinks not supported"); | 420 | "symlinks not supported"); |
421 | #endif | 421 | #endif |
@@ -430,13 +430,13 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
430 | 430 | ||
431 | if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { | 431 | if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { |
432 | if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { | 432 | if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { |
433 | errorMsg("%s: Cannot mknod: %s\n", | 433 | error_msg("%s: Cannot mknod: %s\n", |
434 | header->name, strerror(errno)); | 434 | header->name, strerror(errno)); |
435 | return( FALSE); | 435 | return( FALSE); |
436 | } | 436 | } |
437 | } else if (S_ISFIFO(header->mode)) { | 437 | } else if (S_ISFIFO(header->mode)) { |
438 | if (mkfifo(header->name, header->mode) < 0) { | 438 | if (mkfifo(header->name, header->mode) < 0) { |
439 | errorMsg("%s: Cannot mkfifo: %s\n", | 439 | error_msg("%s: Cannot mkfifo: %s\n", |
440 | header->name, strerror(errno)); | 440 | header->name, strerror(errno)); |
441 | return( FALSE); | 441 | return( FALSE); |
442 | } | 442 | } |
@@ -455,9 +455,9 @@ static long getOctal(const char *cp, int size) | |||
455 | long val = 0; | 455 | long val = 0; |
456 | 456 | ||
457 | for(;(size > 0) && (*cp == ' '); cp++, size--); | 457 | for(;(size > 0) && (*cp == ' '); cp++, size--); |
458 | if ((size == 0) || !isOctal(*cp)) | 458 | if ((size == 0) || !is_octal(*cp)) |
459 | return -1; | 459 | return -1; |
460 | for(; (size > 0) && isOctal(*cp); size--) { | 460 | for(; (size > 0) && is_octal(*cp); size--) { |
461 | val = val * 8 + *cp++ - '0'; | 461 | val = val * 8 + *cp++ - '0'; |
462 | } | 462 | } |
463 | for (;(size > 0) && (*cp == ' '); cp++, size--); | 463 | for (;(size > 0) && (*cp == ' '); cp++, size--); |
@@ -484,7 +484,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header) | |||
484 | ++*(header->name); | 484 | ++*(header->name); |
485 | 485 | ||
486 | if (alreadyWarned == FALSE) { | 486 | if (alreadyWarned == FALSE) { |
487 | errorMsg("Removing leading '/' from member names\n"); | 487 | error_msg("Removing leading '/' from member names\n"); |
488 | alreadyWarned = TRUE; | 488 | alreadyWarned = TRUE; |
489 | } | 489 | } |
490 | } | 490 | } |
@@ -538,7 +538,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
538 | else | 538 | else |
539 | tarFd = open(tarName, O_RDONLY); | 539 | tarFd = open(tarName, O_RDONLY); |
540 | if (tarFd < 0) { | 540 | if (tarFd < 0) { |
541 | errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno)); | 541 | error_msg( "Error opening '%s': %s\n", tarName, strerror(errno)); |
542 | return ( FALSE); | 542 | return ( FALSE); |
543 | } | 543 | } |
544 | 544 | ||
@@ -547,7 +547,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
547 | umask(0); | 547 | umask(0); |
548 | 548 | ||
549 | /* Read the tar file, and iterate over it one file at a time */ | 549 | /* Read the tar file, and iterate over it one file at a time */ |
550 | while ( (status = fullRead(tarFd, (char*)&rawHeader, TAR_BLOCK_SIZE)) == TAR_BLOCK_SIZE ) { | 550 | while ( (status = full_read(tarFd, (char*)&rawHeader, TAR_BLOCK_SIZE)) == TAR_BLOCK_SIZE ) { |
551 | 551 | ||
552 | /* Try to read the header */ | 552 | /* Try to read the header */ |
553 | if ( readTarHeader(&rawHeader, &header) == FALSE ) { | 553 | if ( readTarHeader(&rawHeader, &header) == FALSE ) { |
@@ -555,7 +555,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
555 | goto endgame; | 555 | goto endgame; |
556 | } else { | 556 | } else { |
557 | errorFlag=TRUE; | 557 | errorFlag=TRUE; |
558 | errorMsg("Bad tar header, skipping\n"); | 558 | error_msg("Bad tar header, skipping\n"); |
559 | continue; | 559 | continue; |
560 | } | 560 | } |
561 | } | 561 | } |
@@ -572,7 +572,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
572 | } | 572 | } |
573 | if ( skipNextHeaderFlag == TRUE ) { | 573 | if ( skipNextHeaderFlag == TRUE ) { |
574 | skipNextHeaderFlag=FALSE; | 574 | skipNextHeaderFlag=FALSE; |
575 | errorMsg(name_longer_than_foo, NAME_SIZE); | 575 | error_msg(name_longer_than_foo, NAME_SIZE); |
576 | if (tarExtractRegularFile(&header, FALSE, FALSE) == FALSE) | 576 | if (tarExtractRegularFile(&header, FALSE, FALSE) == FALSE) |
577 | errorFlag = TRUE; | 577 | errorFlag = TRUE; |
578 | continue; | 578 | continue; |
@@ -638,7 +638,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
638 | char buf[35]; | 638 | char buf[35]; |
639 | struct tm *tm = localtime (&(header.mtime)); | 639 | struct tm *tm = localtime (&(header.mtime)); |
640 | 640 | ||
641 | len=printf("%s ", modeString(header.mode)); | 641 | len=printf("%s ", mode_string(header.mode)); |
642 | memset(buf, 0, 8*sizeof(char)); | 642 | memset(buf, 0, 8*sizeof(char)); |
643 | my_getpwuid(buf, header.uid); | 643 | my_getpwuid(buf, header.uid); |
644 | if (! *buf) | 644 | if (! *buf) |
@@ -731,7 +731,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
731 | break; | 731 | break; |
732 | #endif | 732 | #endif |
733 | default: | 733 | default: |
734 | errorMsg("Unknown file type '%c' in tar file\n", header.type); | 734 | error_msg("Unknown file type '%c' in tar file\n", header.type); |
735 | close( tarFd); | 735 | close( tarFd); |
736 | return( FALSE); | 736 | return( FALSE); |
737 | } | 737 | } |
@@ -739,11 +739,11 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
739 | close(tarFd); | 739 | close(tarFd); |
740 | if (status > 0) { | 740 | if (status > 0) { |
741 | /* Bummer - we read a partial header */ | 741 | /* Bummer - we read a partial header */ |
742 | errorMsg( "Error reading '%s': %s\n", tarName, strerror(errno)); | 742 | error_msg( "Error reading '%s': %s\n", tarName, strerror(errno)); |
743 | return ( FALSE); | 743 | return ( FALSE); |
744 | } | 744 | } |
745 | else if (errorFlag==TRUE) { | 745 | else if (errorFlag==TRUE) { |
746 | errorMsg( "Error exit delayed from previous errors\n"); | 746 | error_msg( "Error exit delayed from previous errors\n"); |
747 | return( FALSE); | 747 | return( FALSE); |
748 | } else | 748 | } else |
749 | return( status); | 749 | return( status); |
@@ -753,13 +753,13 @@ endgame: | |||
753 | close( tarFd); | 753 | close( tarFd); |
754 | if (extractList != NULL) { | 754 | if (extractList != NULL) { |
755 | for (; *extractList != NULL; extractList++) { | 755 | for (; *extractList != NULL; extractList++) { |
756 | errorMsg("%s: Not found in archive\n", *extractList); | 756 | error_msg("%s: Not found in archive\n", *extractList); |
757 | errorFlag = TRUE; | 757 | errorFlag = TRUE; |
758 | } | 758 | } |
759 | } | 759 | } |
760 | if ( *(header.name) == '\0' ) { | 760 | if ( *(header.name) == '\0' ) { |
761 | if (errorFlag==TRUE) | 761 | if (errorFlag==TRUE) |
762 | errorMsg( "Error exit delayed from previous errors\n"); | 762 | error_msg( "Error exit delayed from previous errors\n"); |
763 | else | 763 | else |
764 | return( TRUE); | 764 | return( TRUE); |
765 | } | 765 | } |
@@ -903,7 +903,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
903 | if (*fileName=='/') { | 903 | if (*fileName=='/') { |
904 | static int alreadyWarned=FALSE; | 904 | static int alreadyWarned=FALSE; |
905 | if (alreadyWarned==FALSE) { | 905 | if (alreadyWarned==FALSE) { |
906 | errorMsg("Removing leading '/' from member names\n"); | 906 | error_msg("Removing leading '/' from member names\n"); |
907 | alreadyWarned=TRUE; | 907 | alreadyWarned=TRUE; |
908 | } | 908 | } |
909 | strncpy(header.name, fileName+1, sizeof(header.name)); | 909 | strncpy(header.name, fileName+1, sizeof(header.name)); |
@@ -956,7 +956,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
956 | header.typeflag = SYMTYPE; | 956 | header.typeflag = SYMTYPE; |
957 | link_size = readlink(fileName, buffer, sizeof(buffer) - 1); | 957 | link_size = readlink(fileName, buffer, sizeof(buffer) - 1); |
958 | if ( link_size < 0) { | 958 | if ( link_size < 0) { |
959 | errorMsg("Error reading symlink '%s': %s\n", header.name, strerror(errno)); | 959 | error_msg("Error reading symlink '%s': %s\n", header.name, strerror(errno)); |
960 | return ( FALSE); | 960 | return ( FALSE); |
961 | } | 961 | } |
962 | buffer[link_size] = '\0'; | 962 | buffer[link_size] = '\0'; |
@@ -978,7 +978,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
978 | header.typeflag = REGTYPE; | 978 | header.typeflag = REGTYPE; |
979 | putOctal(header.size, sizeof(header.size), statbuf->st_size); | 979 | putOctal(header.size, sizeof(header.size), statbuf->st_size); |
980 | } else { | 980 | } else { |
981 | errorMsg("%s: Unknown file type\n", fileName); | 981 | error_msg("%s: Unknown file type\n", fileName); |
982 | return ( FALSE); | 982 | return ( FALSE); |
983 | } | 983 | } |
984 | 984 | ||
@@ -994,8 +994,8 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
994 | putOctal(header.chksum, 7, chksum); | 994 | putOctal(header.chksum, 7, chksum); |
995 | 995 | ||
996 | /* Now write the header out to disk */ | 996 | /* Now write the header out to disk */ |
997 | if ((size=fullWrite(tbInfo->tarFd, (char*)&header, sizeof(struct TarHeader))) < 0) { | 997 | if ((size=full_write(tbInfo->tarFd, (char*)&header, sizeof(struct TarHeader))) < 0) { |
998 | errorMsg(io_error, fileName, strerror(errno)); | 998 | error_msg(io_error, fileName, strerror(errno)); |
999 | return ( FALSE); | 999 | return ( FALSE); |
1000 | } | 1000 | } |
1001 | /* Pad the header up to the tar block size */ | 1001 | /* Pad the header up to the tar block size */ |
@@ -1036,7 +1036,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
1036 | 1036 | ||
1037 | /* It is against the rules to archive a socket */ | 1037 | /* It is against the rules to archive a socket */ |
1038 | if (S_ISSOCK(statbuf->st_mode)) { | 1038 | if (S_ISSOCK(statbuf->st_mode)) { |
1039 | errorMsg("%s: socket ignored\n", fileName); | 1039 | error_msg("%s: socket ignored\n", fileName); |
1040 | return( TRUE); | 1040 | return( TRUE); |
1041 | } | 1041 | } |
1042 | 1042 | ||
@@ -1045,12 +1045,12 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
1045 | * the new tarball */ | 1045 | * the new tarball */ |
1046 | if (tbInfo->statBuf.st_dev == statbuf->st_dev && | 1046 | if (tbInfo->statBuf.st_dev == statbuf->st_dev && |
1047 | tbInfo->statBuf.st_ino == statbuf->st_ino) { | 1047 | tbInfo->statBuf.st_ino == statbuf->st_ino) { |
1048 | errorMsg("%s: file is the archive; skipping\n", fileName); | 1048 | error_msg("%s: file is the archive; skipping\n", fileName); |
1049 | return( TRUE); | 1049 | return( TRUE); |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | if (strlen(fileName) >= NAME_SIZE) { | 1052 | if (strlen(fileName) >= NAME_SIZE) { |
1053 | errorMsg(name_longer_than_foo, NAME_SIZE); | 1053 | error_msg(name_longer_than_foo, NAME_SIZE); |
1054 | return ( TRUE); | 1054 | return ( TRUE); |
1055 | } | 1055 | } |
1056 | 1056 | ||
@@ -1067,21 +1067,21 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
1067 | 1067 | ||
1068 | /* open the file we want to archive, and make sure all is well */ | 1068 | /* open the file we want to archive, and make sure all is well */ |
1069 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { | 1069 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { |
1070 | errorMsg("%s: Cannot open: %s\n", fileName, strerror(errno)); | 1070 | error_msg("%s: Cannot open: %s\n", fileName, strerror(errno)); |
1071 | return( FALSE); | 1071 | return( FALSE); |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | /* write the file to the archive */ | 1074 | /* write the file to the archive */ |
1075 | while ( (size = fullRead(inputFileFd, buffer, sizeof(buffer))) > 0 ) { | 1075 | while ( (size = full_read(inputFileFd, buffer, sizeof(buffer))) > 0 ) { |
1076 | if (fullWrite(tbInfo->tarFd, buffer, size) != size ) { | 1076 | if (full_write(tbInfo->tarFd, buffer, size) != size ) { |
1077 | /* Output file seems to have a problem */ | 1077 | /* Output file seems to have a problem */ |
1078 | errorMsg(io_error, fileName, strerror(errno)); | 1078 | error_msg(io_error, fileName, strerror(errno)); |
1079 | return( FALSE); | 1079 | return( FALSE); |
1080 | } | 1080 | } |
1081 | readSize+=size; | 1081 | readSize+=size; |
1082 | } | 1082 | } |
1083 | if (size == -1) { | 1083 | if (size == -1) { |
1084 | errorMsg(io_error, fileName, strerror(errno)); | 1084 | error_msg(io_error, fileName, strerror(errno)); |
1085 | return( FALSE); | 1085 | return( FALSE); |
1086 | } | 1086 | } |
1087 | /* Pad the file up to the tar block size */ | 1087 | /* Pad the file up to the tar block size */ |
@@ -1106,7 +1106,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1106 | 1106 | ||
1107 | /* Make sure there is at least one file to tar up. */ | 1107 | /* Make sure there is at least one file to tar up. */ |
1108 | if (*argv == NULL) | 1108 | if (*argv == NULL) |
1109 | fatalError("Cowardly refusing to create an empty archive\n"); | 1109 | error_msg_and_die("Cowardly refusing to create an empty archive\n"); |
1110 | 1110 | ||
1111 | /* Open the tar file for writing. */ | 1111 | /* Open the tar file for writing. */ |
1112 | if (!strcmp(tarName, "-")) | 1112 | if (!strcmp(tarName, "-")) |
@@ -1114,7 +1114,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1114 | else | 1114 | else |
1115 | tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); | 1115 | tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); |
1116 | if (tbInfo.tarFd < 0) { | 1116 | if (tbInfo.tarFd < 0) { |
1117 | errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno)); | 1117 | error_msg( "Error opening '%s': %s\n", tarName, strerror(errno)); |
1118 | freeHardLinkInfo(&tbInfo.hlInfoHead); | 1118 | freeHardLinkInfo(&tbInfo.hlInfoHead); |
1119 | return ( FALSE); | 1119 | return ( FALSE); |
1120 | } | 1120 | } |
@@ -1122,7 +1122,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1122 | /* Store the stat info for the tarball's file, so | 1122 | /* Store the stat info for the tarball's file, so |
1123 | * can avoid including the tarball into itself.... */ | 1123 | * can avoid including the tarball into itself.... */ |
1124 | if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0) | 1124 | if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0) |
1125 | fatalError(io_error, tarName, strerror(errno)); | 1125 | error_msg_and_die(io_error, tarName, strerror(errno)); |
1126 | 1126 | ||
1127 | /* Set the umask for this process so it doesn't | 1127 | /* Set the umask for this process so it doesn't |
1128 | * screw up permission setting for us later. */ | 1128 | * screw up permission setting for us later. */ |
@@ -1130,7 +1130,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1130 | 1130 | ||
1131 | /* Read the directory/files and iterate over them one at a time */ | 1131 | /* Read the directory/files and iterate over them one at a time */ |
1132 | while (*argv != NULL) { | 1132 | while (*argv != NULL) { |
1133 | if (recursiveAction(*argv++, TRUE, FALSE, FALSE, | 1133 | if (recursive_action(*argv++, TRUE, FALSE, FALSE, |
1134 | writeFileToTarball, writeFileToTarball, | 1134 | writeFileToTarball, writeFileToTarball, |
1135 | (void*) &tbInfo) == FALSE) { | 1135 | (void*) &tbInfo) == FALSE) { |
1136 | errorFlag = TRUE; | 1136 | errorFlag = TRUE; |
@@ -1149,7 +1149,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1149 | /* Hang up the tools, close up shop, head home */ | 1149 | /* Hang up the tools, close up shop, head home */ |
1150 | close(tarFd); | 1150 | close(tarFd); |
1151 | if (errorFlag == TRUE) { | 1151 | if (errorFlag == TRUE) { |
1152 | errorMsg("Error exit delayed from previous errors\n"); | 1152 | error_msg("Error exit delayed from previous errors\n"); |
1153 | freeHardLinkInfo(&tbInfo.hlInfoHead); | 1153 | freeHardLinkInfo(&tbInfo.hlInfoHead); |
1154 | return(FALSE); | 1154 | return(FALSE); |
1155 | } | 1155 | } |