< prev index next >
src/java.base/unix/native/libjava/TimeZone_md.c
Print this page
rev 52659 : 8214077: test java/io/File/SetLastModified.java fails on ARM32
Summary: replace uses of stat with stat64 in UnixFileSystem_md.c and TimeZone_md.c
Reviewed-by: duke
Contributed-by: nick.gasson@arm.com
*** 54,63 ****
--- 54,71 ----
#define fileopen fopen
#define filegets fgets
#define fileclose fclose
#endif
+ #if defined(_ALLBSD_SOURCE)
+ #ifndef MACOSX
+ #define stat64 stat
+ #define lstat64 lstat
+ #define fstat64 fstat
+ #endif
+ #endif
+
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
#else
*** 113,123 ****
*/
static char *
findZoneinfoFile(char *buf, size_t size, const char *dir)
{
DIR *dirp = NULL;
! struct stat statbuf;
struct dirent *dp = NULL;
char *pathname = NULL;
int fd = -1;
char *dbuf = NULL;
char *tz = NULL;
--- 121,131 ----
*/
static char *
findZoneinfoFile(char *buf, size_t size, const char *dir)
{
DIR *dirp = NULL;
! struct stat64 statbuf;
struct dirent *dp = NULL;
char *pathname = NULL;
int fd = -1;
char *dbuf = NULL;
char *tz = NULL;
*** 154,164 ****
pathname = getPathName(dir, dp->d_name);
if (pathname == NULL) {
break;
}
! RESTARTABLE(stat(pathname, &statbuf), res);
if (res == -1) {
break;
}
if (S_ISDIR(statbuf.st_mode)) {
--- 162,172 ----
pathname = getPathName(dir, dp->d_name);
if (pathname == NULL) {
break;
}
! RESTARTABLE(stat64(pathname, &statbuf), res);
if (res == -1) {
break;
}
if (S_ISDIR(statbuf.st_mode)) {
*** 217,227 ****
* if found. Otherwise, NULL is returned.
*/
static char *
getPlatformTimeZoneID()
{
! struct stat statbuf;
char *tz = NULL;
FILE *fp;
int fd;
char *buf;
size_t size;
--- 225,235 ----
* if found. Otherwise, NULL is returned.
*/
static char *
getPlatformTimeZoneID()
{
! struct stat64 statbuf;
char *tz = NULL;
FILE *fp;
int fd;
char *buf;
size_t size;
*** 254,264 ****
#endif /* defined(__linux__) */
/*
* Next, try /etc/localtime to find the zone ID.
*/
! RESTARTABLE(lstat(DEFAULT_ZONEINFO_FILE, &statbuf), res);
if (res == -1) {
return NULL;
}
/*
--- 262,272 ----
#endif /* defined(__linux__) */
/*
* Next, try /etc/localtime to find the zone ID.
*/
! RESTARTABLE(lstat64(DEFAULT_ZONEINFO_FILE, &statbuf), res);
if (res == -1) {
return NULL;
}
/*
*** 294,304 ****
RESTARTABLE(open(DEFAULT_ZONEINFO_FILE, O_RDONLY), fd);
if (fd == -1) {
return NULL;
}
! RESTARTABLE(fstat(fd, &statbuf), res);
if (res == -1) {
(void) close(fd);
return NULL;
}
size = (size_t) statbuf.st_size;
--- 302,312 ----
RESTARTABLE(open(DEFAULT_ZONEINFO_FILE, O_RDONLY), fd);
if (fd == -1) {
return NULL;
}
! RESTARTABLE(fstat64(fd, &statbuf), res);
if (res == -1) {
(void) close(fd);
return NULL;
}
size = (size_t) statbuf.st_size;
*** 555,565 ****
* /usr/share/lib/zoneinfo/localtime under /usr/share/lib/zoneinfo/.
*/
static char *
getSolarisDefaultZoneID() {
char *tz = NULL;
! struct stat statbuf;
size_t size;
char *buf;
int fd;
int res;
/* scf specific variables */
--- 563,573 ----
* /usr/share/lib/zoneinfo/localtime under /usr/share/lib/zoneinfo/.
*/
static char *
getSolarisDefaultZoneID() {
char *tz = NULL;
! struct stat64 statbuf;
size_t size;
char *buf;
int fd;
int res;
/* scf specific variables */
*** 595,605 ****
}
}
}
cleanupScf(h, snap, inst, pg, prop, val, tz);
! RESTARTABLE(stat(DEFAULT_ZONEINFO_FILE, &statbuf), res);
if (res == -1) {
return NULL;
}
size = (size_t) statbuf.st_size;
buf = malloc(size);
--- 603,613 ----
}
}
}
cleanupScf(h, snap, inst, pg, prop, val, tz);
! RESTARTABLE(stat64(DEFAULT_ZONEINFO_FILE, &statbuf), res);
if (res == -1) {
return NULL;
}
size = (size_t) statbuf.st_size;
buf = malloc(size);
< prev index next >