summaryrefslogtreecommitdiffstats
path: root/win/tclWinChan.c
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2014-02-11 08:53:33 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2014-02-11 08:53:33 (GMT)
commit89583a6623c604081575a6bc1262024c05f5f8ae (patch)
tree03bd9ea1a62464856e300f703bcae2066e7f4afc /win/tclWinChan.c
parent42f972d403a3a29d99ee4447882e68b07c0c8989 (diff)
downloadtcl-89583a6623c604081575a6bc1262024c05f5f8ae.zip
tcl-89583a6623c604081575a6bc1262024c05f5f8ae.tar.gz
tcl-89583a6623c604081575a6bc1262024c05f5f8ae.tar.bz2
Changed position of flag evaluation as proposed by Phil Hoffman
Diffstat (limited to 'win/tclWinChan.c')
-rw-r--r--win/tclWinChan.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index 19e3655..6d480a8 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -886,24 +886,6 @@ TclpOpenFileChannel(
}
/*
- * If the file is being created, get the file attributes from the
- * permissions argument, else use the existing file attributes.
- */
-
- if (mode & O_CREAT) {
- if (permissions & S_IWRITE) {
- flags = FILE_ATTRIBUTE_NORMAL;
- } else {
- flags = FILE_ATTRIBUTE_READONLY;
- }
- } else {
- flags = (*tclWinProcs->getFileAttributesProc)(nativeName);
- if (flags == 0xFFFFFFFF) {
- flags = 0;
- }
- }
-
- /*
* [2413550] Avoid double-open of serial ports on Windows
* Special handling for Windows serial ports by a "name-hint"
* to directly open it with the OVERLAPPED flag set.
@@ -931,6 +913,24 @@ TclpOpenFileChannel(
return channel;
}
/*
+ * If the file is being created, get the file attributes from the
+ * permissions argument, else use the existing file attributes.
+ */
+
+ if (mode & O_CREAT) {
+ if (permissions & S_IWRITE) {
+ flags = FILE_ATTRIBUTE_NORMAL;
+ } else {
+ flags = FILE_ATTRIBUTE_READONLY;
+ }
+ } else {
+ flags = (*tclWinProcs->getFileAttributesProc)(nativeName);
+ if (flags == 0xFFFFFFFF) {
+ flags = 0;
+ }
+ }
+
+ /*
* Set up the file sharing mode. We want to allow simultaneous access.
*/