diff options
author | lars@mysql.com <> | 2005-05-24 01:09:23 +0200 |
---|---|---|
committer | lars@mysql.com <> | 2005-05-24 01:09:23 +0200 |
commit | 93565c8e7de218bf8c8316cc3a1d862cb33a948b (patch) | |
tree | a317cae0f94ff915ab5ccd337345a22c1c5d62af /mysys | |
parent | a21eb5d0267f1387d423b3c22eb631a0c45388fc (diff) | |
parent | 76a20eb3976909d7e07ed6db19f05caef71e8d5b (diff) | |
download | mariadb-git-93565c8e7de218bf8c8316cc3a1d862cb33a948b.tar.gz |
Merge mysql.com:/home/bkroot/mysql-4.1 into mysql.com:/home/bk/c4944-4.1
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_fopen.c | 19 | ||||
-rw-r--r-- | mysys/my_open.c | 7 |
2 files changed, 23 insertions, 3 deletions
diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index e918b7b0de2..4310250bd0d 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -33,9 +33,22 @@ FILE *my_fopen(const char *FileName, int Flags, myf MyFlags) DBUG_ENTER("my_fopen"); DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d", FileName, Flags, MyFlags)); - - make_ftype(type,Flags); - if ((fd = fopen(FileName, type)) != 0) + /* + 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 + */ +#ifdef __WIN__ + if (! (Flags & O_CREAT) && my_access(FileName, F_OK)) + fd=0; + else +#endif + { + make_ftype(type,Flags); + fd = fopen(FileName, type); + } + + if (fd != 0) { /* The test works if MY_NFILE < 128. The problem is that fileno() is char diff --git a/mysys/my_open.c b/mysys/my_open.c index ca5c0d8683f..ea4d99c3e8c 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -46,6 +46,13 @@ File my_open(const char *FileName, int Flags, myf MyFlags) DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d", 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 + */ + if (! (Flags & O_CREAT) && my_access(FileName, F_OK)) + return -1; if (Flags & O_SHARE) fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); |