summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai2001-11-12 16:44:55 +0000
committerMatt Kraai2001-11-12 16:44:55 +0000
commita5f09c668e8571844c065041f3c1f122fa5c62fe (patch)
tree7bb51b4c59e729627b3113a5528c59a0351b1de5
parentc5f9a9dd0cf2154de6a581ffc9018715a02c118b (diff)
downloadbusybox-a5f09c668e8571844c065041f3c1f122fa5c62fe.zip
busybox-a5f09c668e8571844c065041f3c1f122fa5c62fe.tar.gz
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 8d639d6..22051da 100644
--- a/archival/rpm2cpio.c
+++ b/archival/rpm2cpio.c
@@ -68,8 +68,7 @@ extern int rpm2cpio_main(int argc, char **argv)
if (argc == 1) {
rpmfile = stdin;
} else {
- rpmfile = fopen(argv[1], "r");
- if (!rpmfile) perror_msg_and_die("Can't open rpm file");
+ rpmfile = xfopen(argv[1], "r");
/* set the buffer size */
setvbuf(rpmfile, NULL, _IOFBF, 0x8000);
}
diff --git a/editors/sed.c b/editors/sed.c
index 428b516..3afa64e 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -804,7 +804,7 @@ static void process_file(FILE *file)
extern int sed_main(int argc, char **argv)
{
- int opt;
+ int opt, status = EXIT_SUCCESS;
#ifdef CONFIG_FEATURE_CLEAN_UP
/* destroy command strings on exit */
@@ -851,15 +851,13 @@ extern int sed_main(int argc, char **argv)
int i;
FILE *file;
for (i = optind; i < argc; i++) {
- file = fopen(argv[i], "r");
- if (file == NULL) {
- perror_msg("%s", argv[i]);
- } else {
+ if (file = wfopen(argv[i], "r")) {
process_file(file);
fclose(file);
- }
+ } else
+ status = EXIT_FAILURE;
}
}
- return 0;
+ return status;
}
diff --git a/shell/ash.c b/shell/ash.c
index feee31d..f218a88 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11815,10 +11815,8 @@ opentrace() {
#else
strcpy(s, "./trace");
#endif /* not_this_way */
- if ((tracefile = fopen(s, "a")) == NULL) {
- fprintf(stderr, "Can't open %s\n", s);
+ if ((tracefile = wfopen(s, "a")) == NULL)
return;
- }
#ifdef O_APPEND
if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0)
fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND);
@@ -12648,7 +12646,7 @@ findvar(struct var **vpp, const char *name)
/*
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin.
- * $Id: ash.c,v 1.34 2001/10/31 11:05:49 andersen Exp $
+ * $Id: ash.c,v 1.35 2001/11/12 16:44:55 kraai Exp $
*/
static int timescmd (int argc, char **argv)
{