46
if we are not creating, then we need to use my_access to make sure
47
the file exists since Windows doesn't handle files like "com1.sym"
42
if we are not creating, then we need to use my_access to make sure
43
the file exists since Windows doesn't handle files like "com1.sym"
51
47
make_ftype(type,flags);
52
48
fd = fopen(filename, type);
108
104
if ((uint) file < my_file_limit && my_file_info[file].type != UNOPEN)
110
106
my_file_info[file].type = UNOPEN;
111
free(my_file_info[file].name);
107
my_free(my_file_info[file].name, MYF(MY_ALLOW_ZERO_PTR));
113
109
pthread_mutex_unlock(&THR_LOCK_open);
125
121
flag Flag used by open()
128
This routine attempts to find the best possible match
129
between a numeric option and a string option that could be
130
fed to fopen. There is not a 1 to 1 mapping between the two.
124
This routine attempts to find the best possible match
125
between a numeric option and a string option that could be
126
fed to fopen. There is not a 1 to 1 mapping between the two.
133
129
On Unix, O_RDONLY is usually 0
137
w == O_WRONLY|O_TRUNC|O_CREAT
138
a == O_WRONLY|O_APPEND|O_CREAT
140
w+ == O_RDWR|O_TRUNC|O_CREAT
133
w == O_WRONLY|O_TRUNC|O_CREAT
134
a == O_WRONLY|O_APPEND|O_CREAT
136
w+ == O_RDWR|O_TRUNC|O_CREAT
141
137
a+ == O_RDWR|O_APPEND|O_CREAT
144
140
static void make_ftype(register char * to, register int flag)
146
/* check some possible invalid combinations */
142
/* check some possible invalid combinations */
147
143
assert((flag & (O_TRUNC | O_APPEND)) != (O_TRUNC | O_APPEND));
148
144
assert((flag & (O_WRONLY | O_RDWR)) != (O_WRONLY | O_RDWR));
150
if ((flag & (O_RDONLY|O_WRONLY)) == O_WRONLY)
151
*to++= (flag & O_APPEND) ? 'a' : 'w';
152
else if (flag & O_RDWR)
146
if ((flag & (O_RDONLY|O_WRONLY)) == O_WRONLY)
147
*to++= (flag & O_APPEND) ? 'a' : 'w';
148
else if (flag & O_RDWR)
154
/* Add '+' after theese */
155
if (flag & (O_TRUNC | O_CREAT))
157
else if (flag & O_APPEND)
150
/* Add '+' after theese */
151
if (flag & (O_TRUNC | O_CREAT))
153
else if (flag & O_APPEND)
162
#if FILE_BINARY /* If we have binary-files */
163
if (flag & FILE_BINARY)
167
167
} /* make_ftype */