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

Function cache_remove_open_tmp

mysys/mf_cache.c:29–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27 */
28
29static my_bool cache_remove_open_tmp(IO_CACHE *cache __attribute__((unused)),
30 const char *name)
31{
32#if O_TEMPORARY == 0
33#if !defined(CANT_DELETE_OPEN_FILES)
34 /* The following should always succeed */
35 (void) my_delete(name,MYF(MY_WME | ME_NOINPUT));
36#else
37 int length;
38 if (!(cache->file_name=
39 (char*) my_malloc((length=strlen(name)+1),MYF(MY_WME))))
40 {
41 my_close(cache->file,MYF(0));
42 cache->file = -1;
43 errno=my_errno=ENOMEM;
44 return 1;
45 }
46 memcpy(cache->file_name,name,length);
47#endif
48#endif /* O_TEMPORARY == 0 */
49 return 0;
50}
51
52 /*
53 ** Open tempfile cached by IO_CACHE

Callers 1

real_open_cached_fileFunction · 0.85

Calls 3

my_deleteFunction · 0.85
my_mallocFunction · 0.85
my_closeFunction · 0.85

Tested by

no test coverage detected