diff --git a/src/redis-cli.c b/src/redis-cli.c index ea920569d..7a1f06341 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -6594,6 +6594,8 @@ static char *fetchMOTDFromCache() static void setMOTDCache(const char *sz) { FILE *pf = fopen(szMotdCachePath(), "wb"); + if (pf == NULL) + return; size_t celem = fwrite(sz, strlen(sz), 1, pf); (void)celem; // best effort fclose(pf);