summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-15 21:14:05 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-15 21:14:05 (GMT)
commit859cb34d2ddbdd2548004b0e044f759ed55e5ebe (patch)
tree208a77acdb455c105e739d589128c3dd644af53e /unix
parent2bdb719524ba2e7826cfdf6a82bd80c2bcdd9c75 (diff)
parent5841a02367f05ffbefe36849606d77718a556cb2 (diff)
downloadtcl-859cb34d2ddbdd2548004b0e044f759ed55e5ebe.zip
tcl-859cb34d2ddbdd2548004b0e044f759ed55e5ebe.tar.gz
tcl-859cb34d2ddbdd2548004b0e044f759ed55e5ebe.tar.bz2
[Bug 3288345] Wrong Tcl_StatBuf used on Cygwin
Diffstat (limited to 'unix')
-rw-r--r--unix/tclUnixFile.c34
-rw-r--r--unix/tclUnixPort.h7
2 files changed, 40 insertions, 1 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index c8afeb2..fe3c608 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -1178,6 +1178,40 @@ TclpUtime(
{
return utime(Tcl_FSGetNativePath(pathPtr), tval);
}
+#ifdef __CYGWIN__
+int TclOSstat(const char *name, Tcl_StatBuf *statBuf) {
+ struct stat buf;
+ int result = stat(name, &buf);
+ statBuf->st_mode = buf.st_mode;
+ statBuf->st_ino = buf.st_ino;
+ statBuf->st_dev = buf.st_dev;
+ statBuf->st_rdev = buf.st_rdev;
+ statBuf->st_nlink = buf.st_nlink;
+ statBuf->st_uid = buf.st_uid;
+ statBuf->st_gid = buf.st_gid;
+ statBuf->st_size = buf.st_size;
+ statBuf->st_atime = buf.st_atime;
+ statBuf->st_mtime = buf.st_mtime;
+ statBuf->st_ctime = buf.st_ctime;
+ return result;
+}
+int TclOSlstat(const char *name, Tcl_StatBuf *statBuf) {
+ struct stat buf;
+ int result = lstat(name, &buf);
+ statBuf->st_mode = buf.st_mode;
+ statBuf->st_ino = buf.st_ino;
+ statBuf->st_dev = buf.st_dev;
+ statBuf->st_rdev = buf.st_rdev;
+ statBuf->st_nlink = buf.st_nlink;
+ statBuf->st_uid = buf.st_uid;
+ statBuf->st_gid = buf.st_gid;
+ statBuf->st_size = buf.st_size;
+ statBuf->st_atime = buf.st_atime;
+ statBuf->st_mtime = buf.st_mtime;
+ statBuf->st_ctime = buf.st_ctime;
+ return result;
+}
+#endif
/*
* Local Variables:
diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h
index 2666fb5..48aef9c 100644
--- a/unix/tclUnixPort.h
+++ b/unix/tclUnixPort.h
@@ -78,7 +78,12 @@ typedef off_t Tcl_SeekOffset;
# define TclOSopen open
#endif
-#ifdef HAVE_STRUCT_STAT64
+#ifdef __CYGWIN__
+MODULE_SCOPE int TclOSstat(const char *name, Tcl_StatBuf *statBuf);
+MODULE_SCOPE int TclOSlstat(const char *name, Tcl_StatBuf *statBuf);
+#undef HAVE_STRUCT_STAT_ST_BLOCKS
+#undef HAVE_STRUCT_STAT_ST_BLKSIZE
+#elif defined(HAVE_STRUCT_STAT64)
# define TclOSstat stat64
# define TclOSlstat lstat64
#else