< 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,10 +54,18 @@
#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,11 +121,11 @@
*/
static char *
findZoneinfoFile(char *buf, size_t size, const char *dir)
{
DIR *dirp = NULL;
- struct stat statbuf;
+ struct stat64 statbuf;
struct dirent *dp = NULL;
char *pathname = NULL;
int fd = -1;
char *dbuf = NULL;
char *tz = NULL;
@@ -154,11 +162,11 @@
pathname = getPathName(dir, dp->d_name);
if (pathname == NULL) {
break;
}
- RESTARTABLE(stat(pathname, &statbuf), res);
+ RESTARTABLE(stat64(pathname, &statbuf), res);
if (res == -1) {
break;
}
if (S_ISDIR(statbuf.st_mode)) {
@@ -217,11 +225,11 @@
* if found. Otherwise, NULL is returned.
*/
static char *
getPlatformTimeZoneID()
{
- struct stat statbuf;
+ struct stat64 statbuf;
char *tz = NULL;
FILE *fp;
int fd;
char *buf;
size_t size;
@@ -254,11 +262,11 @@
#endif /* defined(__linux__) */
/*
* Next, try /etc/localtime to find the zone ID.
*/
- RESTARTABLE(lstat(DEFAULT_ZONEINFO_FILE, &statbuf), res);
+ RESTARTABLE(lstat64(DEFAULT_ZONEINFO_FILE, &statbuf), res);
if (res == -1) {
return NULL;
}
/*
@@ -294,11 +302,11 @@
RESTARTABLE(open(DEFAULT_ZONEINFO_FILE, O_RDONLY), fd);
if (fd == -1) {
return NULL;
}
- RESTARTABLE(fstat(fd, &statbuf), res);
+ RESTARTABLE(fstat64(fd, &statbuf), res);
if (res == -1) {
(void) close(fd);
return NULL;
}
size = (size_t) statbuf.st_size;
@@ -555,11 +563,11 @@
* /usr/share/lib/zoneinfo/localtime under /usr/share/lib/zoneinfo/.
*/
static char *
getSolarisDefaultZoneID() {
char *tz = NULL;
- struct stat statbuf;
+ struct stat64 statbuf;
size_t size;
char *buf;
int fd;
int res;
/* scf specific variables */
@@ -595,11 +603,11 @@
}
}
}
cleanupScf(h, snap, inst, pg, prop, val, tz);
- RESTARTABLE(stat(DEFAULT_ZONEINFO_FILE, &statbuf), res);
+ RESTARTABLE(stat64(DEFAULT_ZONEINFO_FILE, &statbuf), res);
if (res == -1) {
return NULL;
}
size = (size_t) statbuf.st_size;
buf = malloc(size);
< prev index next >