Use fopen wrapper.

This commit is contained in:
Matt Kraai 2001-11-12 16:44:55 +00:00
parent c5f9a9dd0c
commit a5f09c668e
3 changed files with 8 additions and 13 deletions

View File

@ -68,8 +68,7 @@ extern int rpm2cpio_main(int argc, char **argv)
if (argc == 1) { if (argc == 1) {
rpmfile = stdin; rpmfile = stdin;
} else { } else {
rpmfile = fopen(argv[1], "r"); rpmfile = xfopen(argv[1], "r");
if (!rpmfile) perror_msg_and_die("Can't open rpm file");
/* set the buffer size */ /* set the buffer size */
setvbuf(rpmfile, NULL, _IOFBF, 0x8000); setvbuf(rpmfile, NULL, _IOFBF, 0x8000);
} }

View File

@ -804,7 +804,7 @@ static void process_file(FILE *file)
extern int sed_main(int argc, char **argv) extern int sed_main(int argc, char **argv)
{ {
int opt; int opt, status = EXIT_SUCCESS;
#ifdef CONFIG_FEATURE_CLEAN_UP #ifdef CONFIG_FEATURE_CLEAN_UP
/* destroy command strings on exit */ /* destroy command strings on exit */
@ -851,15 +851,13 @@ extern int sed_main(int argc, char **argv)
int i; int i;
FILE *file; FILE *file;
for (i = optind; i < argc; i++) { for (i = optind; i < argc; i++) {
file = fopen(argv[i], "r"); if (file = wfopen(argv[i], "r")) {
if (file == NULL) {
perror_msg("%s", argv[i]);
} else {
process_file(file); process_file(file);
fclose(file); fclose(file);
} } else
status = EXIT_FAILURE;
} }
} }
return 0; return status;
} }

View File

@ -11815,10 +11815,8 @@ opentrace() {
#else #else
strcpy(s, "./trace"); strcpy(s, "./trace");
#endif /* not_this_way */ #endif /* not_this_way */
if ((tracefile = fopen(s, "a")) == NULL) { if ((tracefile = wfopen(s, "a")) == NULL)
fprintf(stderr, "Can't open %s\n", s);
return; return;
}
#ifdef O_APPEND #ifdef O_APPEND
if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0) if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0)
fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND); 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> * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
* This file contains code for the times builtin. * 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) static int timescmd (int argc, char **argv)
{ {