projects
/
debian
/
pax
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3a2c49c
)
actually apply patch that fixes Hurd FTBFS
author
Bdale Garbee
<bdale@gag.com>
Sat, 22 Oct 2011 21:35:16 +0000
(15:35 -0600)
committer
Bdale Garbee
<bdale@gag.com>
Sat, 22 Oct 2011 21:35:16 +0000
(15:35 -0600)
file_subs.c
patch
|
blob
|
history
tables.c
patch
|
blob
|
history
diff --git
a/file_subs.c
b/file_subs.c
index 73db1af11295febfc8a5c5d6e3123d19bae71325..4191b92969a9787a0ff4102b00e692b224b8b1d4 100644
(file)
--- a/
file_subs.c
+++ b/
file_subs.c
@@
-351,7
+351,7
@@
node_creat(ARCHD *arcn)
int pass = 0;
mode_t file_mode;
struct stat sb;
int pass = 0;
mode_t file_mode;
struct stat sb;
- char
target[MAXPATHLEN]
;
+ char
*target = NULL
;
char *nm = arcn->name;
int len;
char *nm = arcn->name;
int len;
@@
-374,8
+374,15
@@
node_creat(ARCHD *arcn)
if (strcmp(NM_TAR, argv0) == 0 && Lflag) {
while (lstat(nm, &sb) == 0 &&
S_ISLNK(sb.st_mode)) {
if (strcmp(NM_TAR, argv0) == 0 && Lflag) {
while (lstat(nm, &sb) == 0 &&
S_ISLNK(sb.st_mode)) {
+ target = malloc(sb.st_size + 1);
+ if (target == NULL) {
+ oerrno = ENOMEM;
+ syswarn(1, oerrno,
+ "Insufficient memory");
+ return(-1);
+ }
len = readlink(nm, target,
len = readlink(nm, target,
- s
izeof target - 1
);
+ s
b.st_size
);
if (len == -1) {
syswarn(0, errno,
"cannot follow symlink %s in chain for %s",
if (len == -1) {
syswarn(0, errno,
"cannot follow symlink %s in chain for %s",
@@
-411,6
+418,7
@@
badlink:
paxwarn(0,
"%s skipped. Sockets cannot be copied or extracted",
nm);
paxwarn(0,
"%s skipped. Sockets cannot be copied or extracted",
nm);
+ free(target);
return(-1);
case PAX_SLK:
res = symlink(arcn->ln_name, nm);
return(-1);
case PAX_SLK:
res = symlink(arcn->ln_name, nm);
@@
-425,6
+433,7
@@
badlink:
*/
paxwarn(0, "%s has an unknown file type, skipping",
nm);
*/
paxwarn(0, "%s has an unknown file type, skipping",
nm);
+ free(target);
return(-1);
}
return(-1);
}
@@
-440,14
+449,17
@@
badlink:
* we failed to make the node
*/
oerrno = errno;
* we failed to make the node
*/
oerrno = errno;
- if ((ign = unlnk_exist(nm, arcn->type)) < 0)
+ if ((ign = unlnk_exist(nm, arcn->type)) < 0) {
+ free(target);
return(-1);
return(-1);
+ }
if (++pass <= 1)
continue;
if (nodirs || chk_path(nm,arcn->sb.st_uid,arcn->sb.st_gid) < 0) {
syswarn(1, oerrno, "Could not create: %s", nm);
if (++pass <= 1)
continue;
if (nodirs || chk_path(nm,arcn->sb.st_uid,arcn->sb.st_gid) < 0) {
syswarn(1, oerrno, "Could not create: %s", nm);
+ free(target);
return(-1);
}
}
return(-1);
}
}
@@
-465,8
+477,10
@@
badlink:
/*
* symlinks are done now.
*/
/*
* symlinks are done now.
*/
- if (arcn->type == PAX_SLK)
+ if (arcn->type == PAX_SLK) {
+ free(target);
return(0);
return(0);
+ }
/*
* IMPORTANT SECURITY NOTE:
/*
* IMPORTANT SECURITY NOTE:
@@
-517,6
+531,7
@@
badlink:
if (patime || pmtime)
set_ftime(nm, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
if (patime || pmtime)
set_ftime(nm, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
+ free(target);
return(0);
}
return(0);
}
diff --git
a/tables.c
b/tables.c
index e428051c3dadcedb46fa8f7ce442618b3805daa2..0e75ea51e69579c2bf744e1df9cccd0a1c38bed5 100644
(file)
--- a/
tables.c
+++ b/
tables.c
@@
-55,6
+55,7
@@
static const char rcsid[] = "$OpenBSD: tables.c,v 1.25 2007/09/02 15:19:08 deraa
#include "pax.h"
#include "tables.h"
#include "extern.h"
#include "pax.h"
#include "tables.h"
#include "extern.h"
+#include "features.h"
/*
* Routines for controlling the contents of all the different databases pax
/*
* Routines for controlling the contents of all the different databases pax
@@
-1126,13
+1127,21
@@
void
add_dir(char *name, struct stat *psb, int frc_mode)
{
DIRDATA *dblk;
add_dir(char *name, struct stat *psb, int frc_mode)
{
DIRDATA *dblk;
+#if (_POSIX_C_SOURCE - 0) >= 200809L
+ char *rp = NULL;
+#else
char realname[MAXPATHLEN], *rp;
char realname[MAXPATHLEN], *rp;
+#endif
if (dirp == NULL)
return;
if (havechd && *name != '/') {
if (dirp == NULL)
return;
if (havechd && *name != '/') {
+#if (_POSIX_C_SOURCE - 0) >= 200809L
+ if ((rp = realpath(name, NULL)) == NULL) {
+#else
if ((rp = realpath(name, realname)) == NULL) {
if ((rp = realpath(name, realname)) == NULL) {
+#endif
paxwarn(1, "Cannot canonicalize %s", name);
return;
}
paxwarn(1, "Cannot canonicalize %s", name);
return;
}
@@
-1143,6
+1152,9
@@
add_dir(char *name, struct stat *psb, int frc_mode)
if (dblk == NULL) {
paxwarn(1, "Unable to store mode and times for created"
" directory: %s", name);
if (dblk == NULL) {
paxwarn(1, "Unable to store mode and times for created"
" directory: %s", name);
+#if (_POSIX_C_SOURCE - 0) >= 200809L
+ free(rp);
+#endif
return;
}
dirp = dblk;
return;
}
dirp = dblk;
@@
-1152,6
+1164,9
@@
add_dir(char *name, struct stat *psb, int frc_mode)
if ((dblk->name = strdup(name)) == NULL) {
paxwarn(1, "Unable to store mode and times for created"
" directory: %s", name);
if ((dblk->name = strdup(name)) == NULL) {
paxwarn(1, "Unable to store mode and times for created"
" directory: %s", name);
+#if (_POSIX_C_SOURCE - 0) >= 200809L
+ free(rp);
+#endif
return;
}
dblk->mode = psb->st_mode & 0xffff;
return;
}
dblk->mode = psb->st_mode & 0xffff;
@@
-1159,6
+1174,9
@@
add_dir(char *name, struct stat *psb, int frc_mode)
dblk->atime = psb->st_atime;
dblk->frc_mode = frc_mode;
++dircnt;
dblk->atime = psb->st_atime;
dblk->frc_mode = frc_mode;
++dircnt;
+#if (_POSIX_C_SOURCE - 0) >= 200809L
+ free(rp);
+#endif
}
/*
}
/*