summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-11-12 16:44:55 +0000
committerMatt Kraai <kraai@debian.org>2001-11-12 16:44:55 +0000
commita5f09c668e8571844c065041f3c1f122fa5c62fe (patch)
tree7bb51b4c59e729627b3113a5528c59a0351b1de5
parentc5f9a9dd0cf2154de6a581ffc9018715a02c118b (diff)
downloadbusybox-w32-a5f09c668e8571844c065041f3c1f122fa5c62fe.tar.gz
busybox-w32-a5f09c668e8571844c065041f3c1f122fa5c62fe.tar.bz2
busybox-w32-a5f09c668e8571844c065041f3c1f122fa5c62fe.zip
Use fopen wrapper.
-rw-r--r--archival/rpm2cpio.c3
-rw-r--r--editors/sed.c12
-rw-r--r--shell/ash.c6
3 files changed, 8 insertions, 13 deletions
diff --git a/archival/rpm2cpio.c b/archival/rpm2cpio.c
index 8d639d6ad..22051dabf 100644
--- a/archival/rpm2cpio.c
+++ b/archival/rpm2cpio.c
@@ -68,8 +68,7 @@ extern int rpm2cpio_main(int argc, char **argv)
68 if (argc == 1) { 68 if (argc == 1) {
69 rpmfile = stdin; 69 rpmfile = stdin;
70 } else { 70 } else {
71 rpmfile = fopen(argv[1], "r"); 71 rpmfile = xfopen(argv[1], "r");
72 if (!rpmfile) perror_msg_and_die("Can't open rpm file");
73 /* set the buffer size */ 72 /* set the buffer size */
74 setvbuf(rpmfile, NULL, _IOFBF, 0x8000); 73 setvbuf(rpmfile, NULL, _IOFBF, 0x8000);
75 } 74 }
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}
diff --git a/shell/ash.c b/shell/ash.c
index feee31dee..f218a88d5 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11815,10 +11815,8 @@ opentrace() {
11815#else 11815#else
11816 strcpy(s, "./trace"); 11816 strcpy(s, "./trace");
11817#endif /* not_this_way */ 11817#endif /* not_this_way */
11818 if ((tracefile = fopen(s, "a")) == NULL) { 11818 if ((tracefile = wfopen(s, "a")) == NULL)
11819 fprintf(stderr, "Can't open %s\n", s);
11820 return; 11819 return;
11821 }
11822#ifdef O_APPEND 11820#ifdef O_APPEND
11823 if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0) 11821 if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0)
11824 fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND); 11822 fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND);
@@ -12648,7 +12646,7 @@ findvar(struct var **vpp, const char *name)
12648/* 12646/*
12649 * Copyright (c) 1999 Herbert Xu <herbert@debian.org> 12647 * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
12650 * This file contains code for the times builtin. 12648 * This file contains code for the times builtin.
12651 * $Id: ash.c,v 1.34 2001/10/31 11:05:49 andersen Exp $ 12649 * $Id: ash.c,v 1.35 2001/11/12 16:44:55 kraai Exp $
12652 */ 12650 */
12653static int timescmd (int argc, char **argv) 12651static int timescmd (int argc, char **argv)
12654{ 12652{