From 76c76d54f8e207943c503a4c26a866c116241015 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Tue, 27 Jan 2015 19:46:19 +0000 Subject: [PATCH] sed: fix pasto from previous r277802. MFC after: 3 days --- usr.bin/sed/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c index dafb0bd845ef..36a32996a130 100644 --- a/usr.bin/sed/main.c +++ b/usr.bin/sed/main.c @@ -409,10 +409,10 @@ mf_fgets(SPACE *sp, enum e_spflag spflag) if (len >= (ssize_t)sizeof(tmpfname)) errx(1, "%s: name too long", fname); unlink(tmpfname); - if ((outfile = fopen(tmpfname, "w")) == NULL) - err(1, "%s", fname); if (outfile != NULL && outfile != stdout) fclose(outfile); + if ((outfile = fopen(tmpfname, "w")) == NULL) + err(1, "%s", fname); fchown(fileno(outfile), sb.st_uid, sb.st_gid); fchmod(fileno(outfile), sb.st_mode & ALLPERMS); outfname = tmpfname;