summaryrefslogtreecommitdiff
path: root/mysys/my_open.c
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-05-25 12:56:47 +0300
committerunknown <monty@mysql.com>2005-05-25 12:56:47 +0300
commit549f56dc3d7fdae2cf7d8ebfbc8a118bf21f12a0 (patch)
tree52be2414a34bc47a37198260633286ca16187fec /mysys/my_open.c
parentb36f9f2eeded87ee629619f0c35840f3bec10013 (diff)
downloadmariadb-git-549f56dc3d7fdae2cf7d8ebfbc8a118bf21f12a0.tar.gz
Cleanup during code review
Faster detection of wrong table names (like PRN) on windows include/my_sys.h: Added check_if_legal_filename() mysys/my_access.c: Added check_if_legal_filename() Set errno if my_access() fails mysys/my_fopen.c: USe check_if_legal_filename() instead of my_access() to detect wrong file names on windows mysys/my_open.c: USe check_if_legal_filename() instead of my_access() to detect wrong file names on windows sql/sql_lex.cc: Portability fix sql/sql_parse.cc: Simple cleanup sql/sql_repl.cc: Cleanup during code review
Diffstat (limited to 'mysys/my_open.c')
-rw-r--r--mysys/my_open.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/mysys/my_open.c b/mysys/my_open.c
index ea4d99c3e8c..7cf40b57403 100644
--- a/mysys/my_open.c
+++ b/mysys/my_open.c
@@ -47,12 +47,15 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
FileName, Flags, MyFlags));
#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2)
/*
- if we are not creating, then we need to use my_access to make
- sure the file exists since Windows doesn't handle files like
- "com1.sym" very well
+ Check that we don't try to open or create a file name that may
+ cause problems for us in the future (like PRN)
*/
- if (! (Flags & O_CREAT) && my_access(FileName, F_OK))
- return -1;
+ if (check_if_legal_filename(FileName))
+ {
+ errno= EACCES;
+ DBUG_RETURN(my_register_filename(-1, FileName, FILE_BY_OPEN,
+ EE_FILENOTFOUND, MyFlags));
+ }
if (Flags & O_SHARE)
fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO,
MY_S_IREAD | MY_S_IWRITE);