aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_util.c
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2015-09-01 15:23:05 -0500
committerPeter Seebach <peter.seebach@windriver.com>2015-09-01 16:23:36 -0500
commit65c0b6ba05f8b86de18adc40530fd7ffae8c1643 (patch)
tree70d9236db5d0ab2a0cacc2dfbd30964c3e1f8d8c /pseudo_util.c
parentcbcbe467c147f8c985bd38e34ab9adb72440f539 (diff)
downloadpseudo-65c0b6ba05f8b86de18adc40530fd7ffae8c1643.tar.gz
pseudo-65c0b6ba05f8b86de18adc40530fd7ffae8c1643.tar.bz2
pseudo-65c0b6ba05f8b86de18adc40530fd7ffae8c1643.zip
Don't use bare lstat.
lstat can fail on XFS if the inode number won't fit in a 32-bit value. Use base_lstat. Also, just in case, don't call it if it's not initialized yet (which should never happen). Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
Diffstat (limited to 'pseudo_util.c')
-rw-r--r--pseudo_util.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/pseudo_util.c b/pseudo_util.c
index 7142670..c81df5a 100644
--- a/pseudo_util.c
+++ b/pseudo_util.c
@@ -83,8 +83,7 @@ static struct pseudo_variables pseudo_env[] = {
static int pseudo_util_initted = -1; /* Not yet run */
/* bypass wrapper logic on path computations */
-int (*pseudo_real_lstat)(const char *path, struct stat *buf) = lstat;
-int (*pseudo_real_fstat)(int, struct stat *buf) = fstat;
+int (*pseudo_real_lstat)(const char *path, PSEUDO_STATBUF *buf) = NULL;
#if 0
static void
@@ -473,7 +472,7 @@ pseudo_append_element(char *newpath, char *root, size_t allocated, char **pcurre
static int link_recursion = 0;
size_t curlen;
char *current;
- struct stat buf;
+ PSEUDO_STATBUF buf;
if (!newpath ||
!pcurrent || !*pcurrent ||
!root || !element) {
@@ -516,7 +515,7 @@ pseudo_append_element(char *newpath, char *root, size_t allocated, char **pcurre
/* if lstat fails, that's fine -- nonexistent files aren't symlinks */
if (!leave_this) {
int is_link;
- is_link = (pseudo_real_lstat(newpath, &buf) != -1) && S_ISLNK(buf.st_mode);
+ is_link = (pseudo_real_lstat) && (pseudo_real_lstat(newpath, &buf) != -1) && S_ISLNK(buf.st_mode);
if (link_recursion >= PSEUDO_MAX_LINK_RECURSION && is_link) {
pseudo_diag("link recursion too deep, not expanding path '%s'.\n", newpath);
is_link = 0;