From: Denys Vlasenko Date: Thu, 7 Apr 2016 22:20:36 +0000 (+0200) Subject: sed: support "-f -" idiom X-Git-Tag: 1_25_0~42 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e4d925b8899e38437311d2c63d0d0d200e04b5a1;p=oweals%2Fbusybox.git sed: support "-f -" idiom Signed-off-by: Denys Vlasenko --- diff --git a/editors/sed.c b/editors/sed.c index 4c7f75521..9c4c8e148 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -1507,12 +1507,12 @@ int sed_main(int argc UNUSED_PARAM, char **argv) while (opt_f) { // -f char *line; FILE *cmdfile; - cmdfile = xfopen_for_read(llist_pop(&opt_f)); + cmdfile = xfopen_stdin(llist_pop(&opt_f)); while ((line = xmalloc_fgetline(cmdfile)) != NULL) { add_cmd(line); free(line); } - fclose(cmdfile); + fclose_if_not_stdin(cmdfile); } /* if we didn't get a pattern from -e or -f, use argv[0] */ if (!(opt & 0x30)) {