diff -ur sandbox-2.10.orig/libsandbox/canonicalize.c sandbox-2.10/libsandbox/canonicalize.c --- sandbox-2.10.orig/libsandbox/canonicalize.c 2016-04-30 11:48:12.408413994 -0400 +++ sandbox-2.10/libsandbox/canonicalize.c 2016-04-30 11:50:19.842748265 -0400 @@ -100,14 +100,14 @@ * If not, try a little harder to consume this path in * case it has symlinks out into a better world ... */ - struct stat st; - if (lstat(rpath, &st) == -1 && errno == EACCES) { + struct stat64 st; + if (lstat64(rpath, &st) == -1 && errno == EACCES) { char *p = rpath; strcpy(rpath, name); do { p = strchr(p, '/'); if (p) *p = '\0'; - if (lstat(rpath, &st)) + if (lstat64(rpath, &st)) break; if (S_ISLNK(st.st_mode)) { ssize_t cnt = readlink(rpath, rpath, path_max); diff -ur sandbox-2.10.orig/libsandbox/libsandbox.c sandbox-2.10/libsandbox/libsandbox.c --- sandbox-2.10.orig/libsandbox/libsandbox.c 2016-04-30 11:48:12.404414047 -0400 +++ sandbox-2.10/libsandbox/libsandbox.c 2016-04-30 11:56:05.627975710 -0400 @@ -318,7 +318,7 @@ char *egetcwd(char *buf, size_t size) { - struct stat st; + struct stat64 st; char *tmpbuf; /* We can't let the C lib allocate memory for us since we have our @@ -361,7 +361,7 @@ */ if ((tmpbuf) && (errno == 0)) { save_errno(); - if (!lstat(buf, &st)) + if (!lstat64(buf, &st)) /* errno is set only on failure */ errno = 0; @@ -420,12 +420,12 @@ static bool write_logfile(const char *logfile, const char *func, const char *path, const char *apath, const char *rpath, bool access) { - struct stat log_stat; + struct stat64 log_stat; int stat_ret; int logfd; bool ret = false; - stat_ret = lstat(logfile, &log_stat); + stat_ret = lstat64(logfile, &log_stat); /* Do not care about failure */ errno = 0; if (stat_ret == 0 && S_ISREG(log_stat.st_mode) == 0) @@ -642,7 +642,7 @@ /* Is this a func that works on symlinks, and is the file a symlink ? */ static bool symlink_func(int sb_nr, int flags, const char *abs_path) { - struct stat st; + struct stat64 st; /* These funcs always operate on symlinks */ if (!(sb_nr == SB_NR_UNLINK || @@ -661,7 +661,7 @@ return false; } - if (-1 != lstat(abs_path, &st) && S_ISLNK(st.st_mode)) + if (-1 != lstat64(abs_path, &st) && S_ISLNK(st.st_mode)) return true; else return false; diff -ur sandbox-2.10.orig/libsandbox/wrapper-funcs/fopen_pre_check.c sandbox-2.10/libsandbox/wrapper-funcs/fopen_pre_check.c --- sandbox-2.10.orig/libsandbox/wrapper-funcs/fopen_pre_check.c 2016-04-30 11:48:12.408413994 -0400 +++ sandbox-2.10/libsandbox/wrapper-funcs/fopen_pre_check.c 2016-04-30 11:52:44.780907109 -0400 @@ -11,8 +11,8 @@ save_errno(); /* If we're trying to read, fail normally if file does not stat */ - struct stat st; - if (-1 == stat(pathname, &st)) { + struct stat64 st; + if (-1 == stat64(pathname, &st)) { sb_debug_dyn("EARLY FAIL: %s(%s): %s\n", func, pathname, strerror(errno)); return false; diff -ur sandbox-2.10.orig/libsandbox/wrapper-funcs/mkdirat_pre_check.c sandbox-2.10/libsandbox/wrapper-funcs/mkdirat_pre_check.c --- sandbox-2.10.orig/libsandbox/wrapper-funcs/mkdirat_pre_check.c 2016-04-30 11:48:12.404414047 -0400 +++ sandbox-2.10/libsandbox/wrapper-funcs/mkdirat_pre_check.c 2016-04-30 11:55:02.380842785 -0400 @@ -31,8 +31,8 @@ * not want to pass this attempt up to the higher levels as those * will trigger a sandbox violation. */ - struct stat st; - if (0 == lstat(canonic, &st)) { + struct stat64 st; + if (0 == lstat64(canonic, &st)) { int new_errno; sb_debug_dyn("EARLY FAIL: %s(%s[%s]) @ lstat: %s\n", func, pathname, canonic, strerror(errno)); @@ -40,7 +40,7 @@ new_errno = EEXIST; /* Hmm, is this a broken symlink we're trying to extend ? */ - if (S_ISLNK(st.st_mode) && stat(pathname, &st) != 0) { + if (S_ISLNK(st.st_mode) && stat64(pathname, &st) != 0) { /* XXX: This awful hack should probably be turned into a * common func that does a better job. For now, we have * enough crap to catch gnulib tests #297026. diff -ur sandbox-2.10.orig/libsandbox/wrapper-funcs/openat_pre_check.c sandbox-2.10/libsandbox/wrapper-funcs/openat_pre_check.c --- sandbox-2.10.orig/libsandbox/wrapper-funcs/openat_pre_check.c 2016-04-30 11:48:12.404414047 -0400 +++ sandbox-2.10/libsandbox/wrapper-funcs/openat_pre_check.c 2016-04-30 11:53:20.816456537 -0400 @@ -21,8 +21,8 @@ return false; /* Doesn't exist -> skip permission checks */ - struct stat st; - if (((flags & O_NOFOLLOW) ? lstat(pathname, &st) : stat(pathname, &st)) == -1) { + struct stat64 st; + if (((flags & O_NOFOLLOW) ? lstat64(pathname, &st) : stat64(pathname, &st)) == -1) { sb_debug_dyn("EARLY FAIL: %s(%s): %s\n", func, pathname, strerror(errno)); return false; diff -ur sandbox-2.10.orig/libsandbox/wrapper-funcs/__wrapper_exec.c sandbox-2.10/libsandbox/wrapper-funcs/__wrapper_exec.c --- sandbox-2.10.orig/libsandbox/wrapper-funcs/__wrapper_exec.c 2016-04-30 11:48:12.404414047 -0400 +++ sandbox-2.10/libsandbox/wrapper-funcs/__wrapper_exec.c 2016-04-30 11:54:31.723367794 -0400 @@ -25,13 +25,13 @@ { int fd; unsigned char *elf; - struct stat st; + struct stat64 st; bool do_trace = false; fd = open(filename, O_RDONLY|O_CLOEXEC); if (fd == -1) return; - if (fstat(fd, &st)) + if (fstat64(fd, &st)) goto out_fd; if (st.st_size < sizeof(Elf64_Ehdr)) goto out_fd; diff -ur sandbox-2.10.orig/libsbutil/gnulib/canonicalize.c sandbox-2.10/libsbutil/gnulib/canonicalize.c --- sandbox-2.10.orig/libsbutil/gnulib/canonicalize.c 2016-04-30 11:48:12.404414047 -0400 +++ sandbox-2.10/libsbutil/gnulib/canonicalize.c 2016-04-30 12:40:09.809698079 -0400 @@ -67,7 +67,7 @@ /* Return true if we've already seen the triple, . If *HT is not initialized, initialize it. */ static bool -seen_triple (Hash_table **ht, char const *filename, struct stat const *st) +seen_triple (Hash_table **ht, char const *filename, struct stat64 const *st) { if (*ht == NULL) { @@ -199,7 +199,7 @@ } else { - struct stat st; + struct stat64 st; if (!ISSLASH (dest[-1])) *dest++ = '/'; @@ -230,7 +230,7 @@ component existence. */ st.st_mode = 0; } - else if ((logical ? stat (rname, &st) : lstat (rname, &st)) != 0) + else if ((logical ? stat64 (rname, &st) : lstat64 (rname, &st)) != 0) { saved_errno = errno; if (can_mode == CAN_EXISTING) diff -ur sandbox-2.10.orig/libsbutil/gnulib/file-set.c sandbox-2.10/libsbutil/gnulib/file-set.c --- sandbox-2.10.orig/libsbutil/gnulib/file-set.c 2016-04-30 11:48:12.404414047 -0400 +++ sandbox-2.10/libsbutil/gnulib/file-set.c 2016-04-30 12:31:23.632282805 -0400 @@ -26,7 +26,7 @@ If HT is NULL, return immediately. If memory allocation fails, exit immediately. */ void -record_file (Hash_table *ht, char const *file, struct stat const *stats) +record_file (Hash_table *ht, char const *file, struct stat64 const *stats) { struct F_triple *ent; @@ -59,7 +59,7 @@ for the file described by FILE and STATS. */ bool seen_file (Hash_table const *ht, char const *file, - struct stat const *stats) + struct stat64 const *stats) { struct F_triple new_ent; diff -ur sandbox-2.10.orig/libsbutil/gnulib/file-set.h sandbox-2.10/libsbutil/gnulib/file-set.h --- sandbox-2.10.orig/libsbutil/gnulib/file-set.h 2016-04-30 11:48:12.404414047 -0400 +++ sandbox-2.10/libsbutil/gnulib/file-set.h 2016-04-30 12:43:26.895505207 -0400 @@ -5,11 +5,11 @@ #include "hash.h" extern void record_file (Hash_table *ht, char const *file, - struct stat const *stats) + struct stat64 const *stats) #if defined __GNUC__ && ((__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3) __attribute__ ((nonnull (2, 3))) #endif ; extern bool seen_file (Hash_table const *ht, char const *file, - struct stat const *stats); + struct stat64 const *stats); diff -ur sandbox-2.10.orig/libsbutil/src/file.c sandbox-2.10/libsbutil/src/file.c --- sandbox-2.10.orig/libsbutil/src/file.c 2016-04-30 11:48:12.404414047 -0400 +++ sandbox-2.10/libsbutil/src/file.c 2016-04-30 12:19:45.961533612 -0400 @@ -15,13 +15,13 @@ bool rc_file_exists (const char *pathname) { - struct stat buf; + struct stat64 buf; int retval; if (!check_str (pathname)) return false; - retval = lstat (pathname, &buf); + retval = lstat64 (pathname, &buf); if (-1 != retval) retval = true; else @@ -33,13 +33,13 @@ bool rc_is_file (const char *pathname, bool follow_link) { - struct stat buf; + struct stat64 buf; int retval; if (!check_str (pathname)) return false; - retval = follow_link ? stat (pathname, &buf) : lstat (pathname, &buf); + retval = follow_link ? stat64 (pathname, &buf) : lstat64 (pathname, &buf); if ((-1 != retval) && (S_ISREG (buf.st_mode))) retval = true; else @@ -51,13 +51,13 @@ bool rc_is_dir (const char *pathname, bool follow_link) { - struct stat buf; + struct stat64 buf; int retval; if (!check_str (pathname)) return false; - retval = follow_link ? stat (pathname, &buf) : lstat (pathname, &buf); + retval = follow_link ? stat64 (pathname, &buf) : lstat64 (pathname, &buf); if ((-1 != retval) && (S_ISDIR (buf.st_mode))) retval = true; else @@ -69,13 +69,13 @@ off_t rc_get_size (const char *pathname, bool follow_link) { - struct stat buf; + struct stat64 buf; int retval; if (!check_str (pathname)) return 0; - retval = follow_link ? stat (pathname, &buf) : lstat (pathname, &buf); + retval = follow_link ? stat64 (pathname, &buf) : lstat64 (pathname, &buf); if (-1 != retval) retval = buf.st_size; else @@ -196,7 +196,7 @@ int rc_file_map (const char *filename, char **buf, size_t * bufsize) { - struct stat stats; + struct stat64 stats; int fd; fd = open (filename, O_RDONLY); @@ -207,7 +207,7 @@ return -1; } - if (fstat (fd, &stats) < 0) + if (fstat64 (fd, &stats) < 0) { rc_errno_set (errno); DBG_MSG ("Failed to stat file!\n"); diff -ur sandbox-2.10.orig/tests/get-group.c sandbox-2.10/tests/get-group.c --- sandbox-2.10.orig/tests/get-group.c 2016-04-30 11:48:12.400414100 -0400 +++ sandbox-2.10/tests/get-group.c 2016-04-30 12:44:15.522904547 -0400 @@ -31,8 +31,8 @@ printf("%i\n", grp->gr_gid); } else { const char *file = argv[1]; - struct stat st; - if (lstat(file, &st)) + struct stat64 st; + if (lstat64(file, &st)) errp("lstat(%s) failed", file); printf("%i\n", st.st_gid); } diff -ur sandbox-2.10.orig/tests/get-user.c sandbox-2.10/tests/get-user.c --- sandbox-2.10.orig/tests/get-user.c 2016-04-30 11:48:12.396414153 -0400 +++ sandbox-2.10/tests/get-user.c 2016-04-30 12:43:54.895161822 -0400 @@ -31,8 +31,8 @@ printf("%i\n", pwd->pw_uid); } else { const char *file = argv[1]; - struct stat st; - if (lstat(file, &st)) + struct stat64 st; + if (lstat64(file, &st)) errp("lstat(%s) failed", file); printf("%i\n", st.st_uid); }