| 31 | #endif |
| 32 | |
| 33 | static 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 | } |
| 47 | static size_t motd_write_callback(void *ptr, size_t size, size_t nmemb, sds *str) |
| 48 | { |
| 49 | *str = sdscatlen(*str, ptr, size*nmemb); |
no test coverage detected