We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentaa2b237 commitb98fd52Copy full SHA for b98fd52
contrib/pg_upgrade/util.c
@@ -81,10 +81,18 @@ pg_log(eLogType type, char *fmt,...)
81
/* fopen() on log_opts.internal might have failed, so check it */
82
if ((type!=PG_VERBOSE||log_opts.verbose)&&log_opts.internal!=NULL)
83
{
84
-fwrite(message,strlen(message),1,log_opts.internal);
+/*
85
+ * There's nothing much we can do about it if fwrite fails, but some
86
+ * platforms declare fwrite with warn_unused_result. Do a little
87
+ * dance with casting to void to shut up the compiler in such cases.
88
+ */
89
+size_trc;
90
+
91
+rc=fwrite(message,strlen(message),1,log_opts.internal);
92
/* if we are using OVERWRITE_MESSAGE, add newline to log file */
93
if (strchr(message,'\r')!=NULL)
-fwrite("\n",1,1,log_opts.internal);
94
+rc=fwrite("\n",1,1,log_opts.internal);
95
+(void)rc;
96
fflush(log_opts.internal);
97
}
98