summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixFile.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-20 10:15:02 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-20 10:15:02 (GMT)
commit10f86a8692c0a3a978d81ff4ab06c6f04dde6d99 (patch)
tree2b91bafe7209fe7a322a5a7f9ec87572e868bf81 /unix/tclUnixFile.c
parent23f5b19d027c7c6f2eec97dd900569b56a9087f7 (diff)
downloadtcl-10f86a8692c0a3a978d81ff4ab06c6f04dde6d99.zip
tcl-10f86a8692c0a3a978d81ff4ab06c6f04dde6d99.tar.gz
tcl-10f86a8692c0a3a978d81ff4ab06c6f04dde6d99.tar.bz2
[Bug 3288345] Wrong Tcl_StatBuf used on Cygwin
(backported from Tcl 8.5)
Diffstat (limited to 'unix/tclUnixFile.c')
-rw-r--r--unix/tclUnixFile.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index c0d81b1..5eac978 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -1,4 +1,4 @@
-/*
+/*
* tclUnixFile.c --
*
* This file contains wrappers around UNIX file handling functions.
@@ -820,3 +820,45 @@ TclpUtime(pathPtr, tval)
{
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:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */