source:
npl/overig/archivetools/pax/pax-3.3-gcc.patch
@
0105685
Last change on this file since 0105685 was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 8.6 KB |
-
src/ar_io.c
diff -Nur pax-3.3-doc/src/ar_io.c pax-3.3-gcc/src/ar_io.c
old new 388 388 * could have written anything yet. 389 389 */ 390 390 if (frmt == NULL) { 391 # ifdef LONG_OFF_T 392 (void)fprintf(listf, "%s: unknown format, %lu bytes skipped.\n", 393 # else 394 (void)fprintf(listf, "%s: unknown format, %qu bytes skipped.\n", 395 # endif 391 (void)fprintf(listf, "%s: unknown format, %" FMT_OFF "u bytes skipped.\n", 396 392 argv0, rdcnt); 397 393 (void)fflush(listf); 398 394 flcnt = 0; … … 400 396 } 401 397 402 398 if (strcmp(NM_CPIO, argv0) == 0) 403 (void)fprintf(listf, "% qu blocks\n", (rdcnt ? rdcnt : wrcnt) / 5120);399 (void)fprintf(listf, "%" FMT_OFF "u blocks\n", (rdcnt ? rdcnt : wrcnt) / 5120); 404 400 else if (strcmp(NM_TAR, argv0) != 0) 405 401 (void)fprintf(listf, 406 # ifdef LONG_OFF_T 407 "%s: %s vol %d, %lu files, %lu bytes read, %lu bytes written.\n", 408 # else 409 "%s: %s vol %d, %lu files, %qu bytes read, %qu bytes written.\n", 410 # endif 402 "%s: %s vol %d, %lu files, %" FMT_OFF "u bytes read, %" FMT_OFF "u bytes written.\n", 411 403 argv0, frmt->name, arvol-1, flcnt, rdcnt, wrcnt); 412 404 (void)fflush(listf); 413 405 flcnt = 0; -
src/ar_subs.c
diff -Nur pax-3.3-doc/src/ar_subs.c pax-3.3-gcc/src/ar_subs.c
old new 57 57 #include <errno.h> 58 58 #include <unistd.h> 59 59 #include <stdlib.h> 60 #include <time.h> 60 61 #include "pax.h" 61 62 #include "extern.h" 62 63 -
src/cpio.c
diff -Nur pax-3.3-doc/src/cpio.c pax-3.3-gcc/src/cpio.c
old new 223 223 */ 224 224 if ((arcn->sb.st_size == 0) || 225 225 (arcn->sb.st_size >= sizeof(arcn->ln_name))) { 226 # ifdef LONG_OFF_T 227 paxwarn(1, "Cpio link name length is invalid: %lu", 228 arcn->sb.st_size); 229 # else 230 paxwarn(1, "Cpio link name length is invalid: %qu", 226 paxwarn(1, "Cpio link name length is invalid: %" FMT_OFF "u", 231 227 arcn->sb.st_size); 232 # endif233 228 return(-1); 234 229 } 235 230 -
src/extern.h
diff -Nur pax-3.3-doc/src/extern.h pax-3.3-gcc/src/extern.h
old new 302 302 int tty_read(char *, int); 303 303 void paxwarn(int, const char *, ...); 304 304 void syswarn(int, int, const char *, ...); 305 306 /* 307 * Handle printing of offsets. 308 */ 309 #ifdef LONG_OFF_T 310 #define FMT_OFF "l" 311 #else 312 #define FMT_OFF "q" 313 #endif -
src/gen_subs.c
diff -Nur pax-3.3-doc/src/gen_subs.c pax-3.3-gcc/src/gen_subs.c
old new 56 56 #include <unistd.h> 57 57 #include <stdlib.h> 58 58 #include <string.h> 59 #include <time.h> 59 60 #include <vis.h> 60 61 #include "pax.h" 61 62 #include "extern.h" … … 128 129 * print device id's for devices, or sizes for other nodes 129 130 */ 130 131 if ((arcn->type == PAX_CHR) || (arcn->type == PAX_BLK)) 131 # ifdef LONG_OFF_T 132 (void)fprintf(fp, "%4u,%4u ", MAJOR(sbp->st_rdev), 133 # else 134 (void)fprintf(fp, "%4lu,%4lu ", (unsigned long)MAJOR(sbp->st_rdev), 135 # endif 132 (void)fprintf(fp, "%4lu,%4lu ", 133 (unsigned long)MAJOR(sbp->st_rdev), 136 134 (unsigned long)MINOR(sbp->st_rdev)); 137 else { 138 # ifdef LONG_OFF_T 139 (void)fprintf(fp, "%9lu ", sbp->st_size); 140 # else 141 (void)fprintf(fp, "%9qu ", sbp->st_size); 142 # endif 143 } 135 else 136 (void)fprintf(fp, "%9" FMT_OFF "u ", sbp->st_size); 144 137 145 138 /* 146 139 * print name and link info for hard and soft links -
src/options.c
diff -Nur pax-3.3-doc/src/options.c pax-3.3-gcc/src/options.c
old new 76 76 static void printflg(unsigned int); 77 77 static int c_frmt(const void *, const void *); 78 78 static off_t str_offt(char *); 79 static char *getl ine(FILE *fp);79 static char *getln(FILE *fp); 80 80 static void pax_options(int, char **); 81 81 static void pax_usage(void); 82 82 static void tar_options(int, char **); … … 87 87 /* errors from getline */ 88 88 #define GETLINE_FILE_CORRUPT 1 89 89 #define GETLINE_OUT_OF_MEM 2 90 static int getl ine_error;90 static int getln_error; 91 91 92 92 93 93 #define GZIP_CMD "gzip" /* command to run as gzip */ … … 520 520 * or list. check that we have not been given a bogus set of flags 521 521 * for the operation mode. 522 522 */ 523 listf = stderr; 523 524 if (ISLIST(flg)) { 524 525 act = LIST; 525 526 listf = stdout; … … 870 871 paxwarn(1, "Unable to open file '%s' for read", file); 871 872 tar_usage(); 872 873 } 873 while ((str = getl ine(fp)) != NULL) {874 while ((str = getln(fp)) != NULL) { 874 875 if (pat_add(str, dir) < 0) 875 876 tar_usage(); 876 877 sawpat = 1; 877 878 } 878 879 if (strcmp(file, "-") != 0) 879 880 fclose(fp); 880 if (getl ine_error) {881 if (getln_error) { 881 882 paxwarn(1, "Problem with file '%s'", file); 882 883 tar_usage(); 883 884 } … … 943 944 paxwarn(1, "Unable to open file '%s' for read", file); 944 945 tar_usage(); 945 946 } 946 while ((str = getl ine(fp)) != NULL) {947 while ((str = getln(fp)) != NULL) { 947 948 if (ftree_add(str, 0) < 0) 948 949 tar_usage(); 949 950 } 950 951 if (strcmp(file, "-") != 0) 951 952 fclose(fp); 952 if (getl ine_error) {953 if (getln_error) { 953 954 paxwarn(1, "Problem with file '%s'", 954 955 file); 955 956 tar_usage(); … … 1030 1031 dflag = 1; 1031 1032 act = -1; 1032 1033 nodirs = 1; 1034 listf = stderr; 1033 1035 while ((c=getopt(argc,argv,"abcdfiklmoprstuvzABC:E:F:H:I:LO:SZ6")) != -1) 1034 1036 switch (c) { 1035 1037 case 'a': … … 1156 1158 paxwarn(1, "Unable to open file '%s' for read", optarg); 1157 1159 cpio_usage(); 1158 1160 } 1159 while ((str = getl ine(fp)) != NULL) {1161 while ((str = getln(fp)) != NULL) { 1160 1162 pat_add(str, NULL); 1161 1163 } 1162 1164 fclose(fp); 1163 if (getl ine_error) {1165 if (getln_error) { 1164 1166 paxwarn(1, "Problem with file '%s'", optarg); 1165 1167 cpio_usage(); 1166 1168 } … … 1255 1257 * no read errors allowed on updates/append operation! 1256 1258 */ 1257 1259 maxflt = 0; 1258 while ((str = getl ine(stdin)) != NULL) {1260 while ((str = getln(stdin)) != NULL) { 1259 1261 ftree_add(str, NULL); 1260 1262 } 1261 if (getl ine_error) {1263 if (getln_error) { 1262 1264 paxwarn(1, "Problem while reading stdin"); 1263 1265 cpio_usage(); 1264 1266 } … … 1483 1485 return(num); 1484 1486 } 1485 1487 1488 /* 1489 * getln() 1490 * read a line and return it in a malloc'ed buffer. 1491 * 1492 * In pax 3.0 this was called my_getline(). somewhere 1493 * between 3.0 and 3.3 it was replaced with a function 1494 * called getline() that did the same thing as my_getline() 1495 * but used fgetln(). fgetln() is not a GNU function - its 1496 * only available on BSD, and that made life difficult. 1497 * Very difficult in fact, as the easiy way to emulate 1498 * fgetln() is to use the GNU getline() function, buts its 1499 * name clashed with the one defined here. This third 1500 * re-write is shorter and faster than the previous two, 1501 * and is compatible with GNU libc. 1502 */ 1486 1503 char * 1487 getl ine(FILE *f)1504 getln(FILE * f) 1488 1505 { 1489 char *name, *temp; 1506 char *name = 0; 1507 size_t buflen = 0; 1490 1508 size_t len; 1491 1509 1492 name = fgetln(f, &len); 1493 if (!name) { 1494 getline_error = ferror(f) ? GETLINE_FILE_CORRUPT : 0; 1510 len = getline(&name, &buflen, f); 1511 if (len == (size_t)-1) { 1512 if (name) 1513 free(name); 1514 getln_error = ferror(f) ? GETLINE_FILE_CORRUPT : 0; 1495 1515 return(0); 1496 1516 } 1497 if (name[len-1] != '\n') 1498 len++; 1499 temp = malloc(len); 1500 if (!temp) { 1501 getline_error = GETLINE_OUT_OF_MEM; 1502 return(0); 1503 } 1504 memcpy(temp, name, len-1); 1505 temp[len-1] = 0; 1506 return(temp); 1517 if (name[len - 1] == '\n') 1518 name[len - 1] = '\0'; 1519 return name; 1507 1520 } 1508 1521 1509 1522 /* 1510 1523 * no_op() 1511 1524 * for those option functions where the archive format has nothing to do. -
src/pax.c
diff -Nur pax-3.3-doc/src/pax.c pax-3.3-gcc/src/pax.c
old new 108 108 char *ltmfrmt; /* -v locale time format (if any) */ 109 109 char *argv0; /* root of argv[0] */ 110 110 sigset_t s_mask; /* signal mask for cleanup critical sect */ 111 FILE *listf = stderr;/* file pointer to print file list to */111 FILE *listf; /* file pointer to print file list to */ 112 112 char *tempfile; /* tempfile to use for mkstemp(3) */ 113 113 char *tempbase; /* basename of tempfile to use for mkstemp(3) */ 114 114 -
src/sel_subs.c
diff -Nur pax-3.3-doc/src/sel_subs.c pax-3.3-gcc/src/sel_subs.c
old new 56 56 #include <stdio.h> 57 57 #include <stdlib.h> 58 58 #include <string.h> 59 #include <time.h> 59 60 #include <tzfile.h> 60 61 #include <unistd.h> 61 62 #include "pax.h"
Note: See TracBrowser
for help on using the repository browser.