diff options
Diffstat (limited to 'contrib/pg_upgrade/option.c')
-rw-r--r-- | contrib/pg_upgrade/option.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/contrib/pg_upgrade/option.c b/contrib/pg_upgrade/option.c index a38a9a80fff..58606dd2bf3 100644 --- a/contrib/pg_upgrade/option.c +++ b/contrib/pg_upgrade/option.c @@ -174,12 +174,10 @@ parseCommandLine(migratorContext *ctx, int argc, char *argv[]) * start. */ /* truncate */ - ctx->log_fd = fopen(ctx->logfile, "w"); - if (!ctx->log_fd) + if ((ctx->log_fd = fopen(ctx->logfile, "w")) == NULL) pg_log(ctx, PG_FATAL, "Cannot write to log file %s\n", ctx->logfile); fclose(ctx->log_fd); - ctx->log_fd = fopen(ctx->logfile, "a"); - if (!ctx->log_fd) + if ((ctx->log_fd = fopen(ctx->logfile, "a")) == NULL) pg_log(ctx, PG_FATAL, "Cannot write to log file %s\n", ctx->logfile); } else |