1 diff -ur pax-20090728/file_subs.c pax-20090728.modified/file_subs.c
2 --- pax-20090728/file_subs.c 2009-07-28 17:38:28.000000000 +0000
3 +++ pax-20090728.modified/file_subs.c 2011-10-15 12:56:46.000000000 +0000
8 - char target[MAXPATHLEN];
10 char *nm = arcn->name;
14 if (strcmp(NM_TAR, argv0) == 0 && Lflag) {
15 while (lstat(nm, &sb) == 0 &&
16 S_ISLNK(sb.st_mode)) {
17 + target = malloc(sb.st_size + 1);
18 + if (target == NULL) {
21 + "Insufficient memory");
24 len = readlink(nm, target,
29 "cannot follow symlink %s in chain for %s",
32 "%s skipped. Sockets cannot be copied or extracted",
37 res = symlink(arcn->ln_name, nm);
40 paxwarn(0, "%s has an unknown file type, skipping",
47 * we failed to make the node
50 - if ((ign = unlnk_exist(nm, arcn->type)) < 0)
51 + if ((ign = unlnk_exist(nm, arcn->type)) < 0) {
59 if (nodirs || chk_path(nm,arcn->sb.st_uid,arcn->sb.st_gid) < 0) {
60 syswarn(1, oerrno, "Could not create: %s", nm);
67 * symlinks are done now.
69 - if (arcn->type == PAX_SLK)
70 + if (arcn->type == PAX_SLK) {
76 * IMPORTANT SECURITY NOTE:
80 set_ftime(nm, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
85 diff -ur pax-20090728/tables.c pax-20090728.modified/tables.c
86 --- pax-20090728/tables.c 2009-07-28 17:38:28.000000000 +0000
87 +++ pax-20090728.modified/tables.c 2011-10-15 13:39:29.000000000 +0000
92 +#include "features.h"
95 * Routines for controlling the contents of all the different databases pax
96 @@ -1126,13 +1127,21 @@
97 add_dir(char *name, struct stat *psb, int frc_mode)
100 +#if (_POSIX_C_SOURCE - 0) >= 200809L
103 char realname[MAXPATHLEN], *rp;
109 if (havechd && *name != '/') {
110 +#if (_POSIX_C_SOURCE - 0) >= 200809L
111 + if ((rp = realpath(name, NULL)) == NULL) {
113 if ((rp = realpath(name, realname)) == NULL) {
115 paxwarn(1, "Cannot canonicalize %s", name);
118 @@ -1143,6 +1152,9 @@
120 paxwarn(1, "Unable to store mode and times for created"
121 " directory: %s", name);
122 +#if (_POSIX_C_SOURCE - 0) >= 200809L
128 @@ -1152,6 +1164,9 @@
129 if ((dblk->name = strdup(name)) == NULL) {
130 paxwarn(1, "Unable to store mode and times for created"
131 " directory: %s", name);
132 +#if (_POSIX_C_SOURCE - 0) >= 200809L
137 dblk->mode = psb->st_mode & 0xffff;
138 @@ -1159,6 +1174,9 @@
139 dblk->atime = psb->st_atime;
140 dblk->frc_mode = frc_mode;
142 +#if (_POSIX_C_SOURCE - 0) >= 200809L