diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index b790777108..0524cb8541 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -6168,7 +6168,7 @@ write_item(const void *data, Size len, FILE *fp) { if (fwrite(&len, 1, sizeof(len), fp) != sizeof(len)) elog(FATAL, "could not write init file"); - if (fwrite(data, 1, len, fp) != len) + if (len > 0 && fwrite(data, 1, len, fp) != len) elog(FATAL, "could not write init file"); }