MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / my_fclose

Function my_fclose

mysys/my_fopen.c:234–266  ·  view source on GitHub ↗

Close a stream */

Source from the content-addressed store, hash-verified

232
233/* Close a stream */
234int my_fclose(FILE *fd, myf MyFlags)
235{
236 int err,file;
237 DBUG_ENTER("my_fclose");
238 DBUG_PRINT("my",("stream: 0x%lx MyFlags: %d", (long) fd, MyFlags));
239
240 mysql_mutex_lock(&THR_LOCK_open);
241 file= my_fileno(fd);
242#ifndef _WIN32
243 err= fclose(fd);
244#else
245 err= my_win_fclose(fd);
246#endif
247 if(err < 0)
248 {
249 my_errno=errno;
250 if (MyFlags & (MY_FAE | MY_WME))
251 {
252 char errbuf[MYSYS_STRERROR_SIZE];
253 my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG), my_filename(file),
254 my_errno, my_strerror(errbuf, sizeof(errbuf), my_errno));
255 }
256 }
257 else
258 my_stream_opened--;
259 if ((uint) file < my_file_limit && my_file_info[file].type != UNOPEN)
260 {
261 my_file_info[file].type = UNOPEN;
262 my_free(my_file_info[file].name);
263 }
264 mysql_mutex_unlock(&THR_LOCK_open);
265 DBUG_RETURN(err);
266} /* my_fclose */
267
268
269 /* Make a stream out of a file handle */

Callers 6

my_fopenFunction · 0.85
convert_fileFunction · 0.85
create_header_filesFunction · 0.85
create_sys_filesFunction · 0.85
parse_input_fileFunction · 0.85
inline_mysql_file_fcloseFunction · 0.85

Calls 6

my_filenoFunction · 0.85
my_win_fcloseFunction · 0.85
my_errorFunction · 0.85
my_filenameFunction · 0.85
my_strerrorFunction · 0.85
my_freeFunction · 0.85

Tested by

no test coverage detected