MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / szMotdCachePath

Function szMotdCachePath

src/motd.cpp:33–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#endif
32
33static const char *szMotdCachePath()
34{
35 static sds sdsMotdCachePath = NULL;
36 if (sdsMotdCachePath != NULL)
37 return sdsMotdCachePath;
38
39 struct passwd *pw = getpwuid(getuid());
40 if (pw == NULL)
41 return "";
42 const char *homedir = pw->pw_dir;
43 sdsMotdCachePath = sdsnew(homedir);
44 sdsMotdCachePath = sdscat(sdsMotdCachePath, motd_cache_file);
45 return sdsMotdCachePath;
46}
47static size_t motd_write_callback(void *ptr, size_t size, size_t nmemb, sds *str)
48{
49 *str = sdscatlen(*str, ptr, size*nmemb);

Callers 2

fetchMOTDFromCacheFunction · 0.85
setMOTDCacheFunction · 0.85

Calls 2

sdsnewFunction · 0.85
sdscatFunction · 0.85

Tested by

no test coverage detected