diff options
| author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2015-01-27 18:58:24 +0000 |
|---|---|---|
| committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2015-01-27 18:58:24 +0000 |
| commit | fc04dce05911dc5a6ababdcbc1ce0eeb726705a1 (patch) | |
| tree | 4a87103f4449f4a603b2e0966844e640a9199520 /usr.bin/sed | |
| parent | c7d7e597b410b3802ed7480d0db628e8449f29cc (diff) | |
Notes
Diffstat (limited to 'usr.bin/sed')
| -rw-r--r-- | usr.bin/sed/main.c | 2 | ||||
| -rw-r--r-- | usr.bin/sed/process.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c index 029a79fdeec6d..dafb0bd845ef4 100644 --- a/usr.bin/sed/main.c +++ b/usr.bin/sed/main.c @@ -411,6 +411,8 @@ mf_fgets(SPACE *sp, enum e_spflag spflag) unlink(tmpfname); if ((outfile = fopen(tmpfname, "w")) == NULL) err(1, "%s", fname); + if (outfile != NULL && outfile != stdout) + fclose(outfile); fchown(fileno(outfile), sb.st_uid, sb.st_gid); fchmod(fileno(outfile), sb.st_mode & ALLPERMS); outfname = tmpfname; diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c index cdfba811ce181..daabfd8bc7f6a 100644 --- a/usr.bin/sed/process.c +++ b/usr.bin/sed/process.c @@ -324,7 +324,7 @@ applies(struct s_command *cp) } else r = 1; } - } else if (MATCH(cp->a1)) { + } else if (cp->a1 && MATCH(cp->a1)) { /* * If the second address is a number less than or * equal to the line number first selected, only |
