aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/sed.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 428b516ad..3afa64e8f 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -804,7 +804,7 @@ static void process_file(FILE *file)
804 804
805extern int sed_main(int argc, char **argv) 805extern int sed_main(int argc, char **argv)
806{ 806{
807 int opt; 807 int opt, status = EXIT_SUCCESS;
808 808
809#ifdef CONFIG_FEATURE_CLEAN_UP 809#ifdef CONFIG_FEATURE_CLEAN_UP
810 /* destroy command strings on exit */ 810 /* destroy command strings on exit */
@@ -851,15 +851,13 @@ extern int sed_main(int argc, char **argv)
851 int i; 851 int i;
852 FILE *file; 852 FILE *file;
853 for (i = optind; i < argc; i++) { 853 for (i = optind; i < argc; i++) {
854 file = fopen(argv[i], "r"); 854 if (file = wfopen(argv[i], "r")) {
855 if (file == NULL) {
856 perror_msg("%s", argv[i]);
857 } else {
858 process_file(file); 855 process_file(file);
859 fclose(file); 856 fclose(file);
860 } 857 } else
858 status = EXIT_FAILURE;
861 } 859 }
862 } 860 }
863 861
864 return 0; 862 return status;
865} 863}