summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdAH.c
diff options
context:
space:
mode:
authorashok <ashok>2016-07-09 11:13:48 (GMT)
committerashok <ashok>2016-07-09 11:13:48 (GMT)
commit673b7ecc2109080c1d8ab85bede83600d5dfff1e (patch)
tree3d67e6cc20a391098bb98a6f2cf76e850dc861e0 /generic/tclCmdAH.c
parent8435bb9d68cdb26190ded1caca280eaac0314444 (diff)
downloadtcl-673b7ecc2109080c1d8ab85bede83600d5dfff1e.zip
tcl-673b7ecc2109080c1d8ab85bede83600d5dfff1e.tar.gz
tcl-673b7ecc2109080c1d8ab85bede83600d5dfff1e.tar.bz2
Bugfix [3613671]. file owned implementation for Windows.
Diffstat (limited to 'generic/tclCmdAH.c')
-rw-r--r--generic/tclCmdAH.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index a53f1f7..13d3df5 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -12,6 +12,9 @@
*/
#include "tclInt.h"
+#ifdef _WIN32
+# include "tclWinInt.h"
+#endif
#include <locale.h>
/*
@@ -1600,21 +1603,13 @@ FileAttrIsOwnedCmd(
Tcl_WrongNumArgs(interp, 1, objv, "name");
return TCL_ERROR;
}
- if (GetStatBuf(NULL, objv[1], Tcl_FSStat, &buf) == TCL_OK) {
- /*
- * For Windows, there are no user ids associated with a file, so we
- * always return 1.
- *
- * TODO: use GetSecurityInfo to get the real owner of the file and
- * test for equivalence to the current user.
- */
-
#if defined(_WIN32) || defined(__CYGWIN__)
- value = 1;
+ value = TclWinFileOwned(objv[1]);
#else
+ if (GetStatBuf(NULL, objv[1], Tcl_FSStat, &buf) == TCL_OK) {
value = (geteuid() == buf.st_uid);
-#endif
}
+#endif
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(value));
return TCL_OK;
}