summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2007-02-13 02:06:22 +0000
committerBruce Momjian2007-02-13 02:06:22 +0000
commit82b4e64864b446bd3aeb6023300acf2597393e72 (patch)
tree28ac9a63f3f07fa58ab2622f5acc428bbe06fdef
parent0b6090233926af055cd9ea9b95fbdc6473fb3807 (diff)
Add comment to explain why O_EXCL and O_TRUNC can be ignored in
openFlagsToCreateFileFlags() in certain cases.
-rw-r--r--src/port/open.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/port/open.c b/src/port/open.c
index b8a5bab973..371ab46906 100644
--- a/src/port/open.c
+++ b/src/port/open.c
@@ -25,6 +25,7 @@ openFlagsToCreateFileFlags(int openFlags)
{
switch (openFlags & (O_CREAT | O_TRUNC | O_EXCL))
{
+ /* O_EXCL is meaningless without O_CREAT */
case 0:
case O_EXCL:
return OPEN_EXISTING;
@@ -32,6 +33,7 @@ openFlagsToCreateFileFlags(int openFlags)
case O_CREAT:
return OPEN_ALWAYS;
+ /* O_EXCL is meaningless without O_CREAT */
case O_TRUNC:
case O_TRUNC | O_EXCL:
return TRUNCATE_EXISTING;
@@ -39,6 +41,7 @@ openFlagsToCreateFileFlags(int openFlags)
case O_CREAT | O_TRUNC:
return CREATE_ALWAYS;
+ /* O_TRUNC is meaningless with O_CREAT */
case O_CREAT | O_EXCL:
case O_CREAT | O_TRUNC | O_EXCL:
return CREATE_NEW;