From: Eric S. Raymond Date: Tue, 16 Sep 2003 04:48:41 +0000 (+0000) Subject: Complain when you can't open an scf file. X-Git-Tag: 2.0~56 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=4d12fd541a36286a7a9bf282df35431f1db2973c;p=comparator.git Complain when you can't open an scf file. --- diff --git a/main.c b/main.c index 50a1bd8..43fcac8 100644 --- a/main.c +++ b/main.c @@ -291,6 +291,11 @@ static void init_scf(char *file, struct scf_t *scf, const int readfile) /* read in the SCF metadata block and add it to the in-core list */ scf->fp = fopen(scf->name, "r"); + if (!scf->fp) + { + fprintf(stderr, "comparator: file %s, %s", scf->name, strerror(errno)); + exit(1); + } fgets(buf, sizeof(buf), scf->fp); if (strncmp(buf, "#SCF-A 2.0", 9)) { @@ -494,16 +499,7 @@ main(int argc, char *argv[]) scflist = scf; if (is_scf_file(source)) - { - if (dir) - { - olddir = getcwd(NULL, 0); /* may fail off Linux */ - chdir(dir); - } init_scf(source, scf, 1); - if (dir) - chdir(olddir); - } else if (compile_only) { FILE *ofp;