diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-02-18 16:46:34 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-02-18 16:47:39 +0100 |
commit | ba736b073560ee96900363fc18e08fd198350c38 (patch) | |
tree | 38c4364f047aa7c6b7011481d4b741691bd6dcb0 /mseq.c | |
parent | f4a3feb70add8bc9becd490bbac1f335abcdf567 (diff) | |
download | mblaze-ba736b073560ee96900363fc18e08fd198350c38.tar.gz mblaze-ba736b073560ee96900363fc18e08fd198350c38.tar.xz mblaze-ba736b073560ee96900363fc18e08fd198350c38.zip |
mseq: better error reporting
Diffstat (limited to 'mseq.c')
-rw-r--r-- | mseq.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/mseq.c b/mseq.c index 4ceacf2..733b141 100644 --- a/mseq.c +++ b/mseq.c @@ -164,7 +164,7 @@ cat(FILE *src, FILE *dst) while ((rd = fread(buf, 1, sizeof buf, src)) > 0) fwrite(buf, 1, rd, dst); if (!feof(src)) { - perror("fread"); + perror("mseq: fread"); exit(2); } } @@ -191,7 +191,12 @@ stdinmode() snprintf(oldfile, sizeof oldfile, "%s.old", seqfile); outfile = fopen(tmpfile, "w+"); if (!outfile) { - perror("fopen"); + fprintf(stderr, + "mseq: Could not create sequence file '%s': %s.\n", + seqfile, strerror(errno)); + fprintf(stderr, + "mseq: Ensure %s exists and is writable.\n", + blaze822_home_file("")); exit(2); } if (Aflag) { @@ -222,11 +227,11 @@ stdinmode() if (Sflag) { fflush(outfile); if (rename(seqfile, oldfile) < 0 && errno != ENOENT) { - perror("rename"); + perror("mseq: rename"); exit(2); } if (rename(tmpfile, seqfile) < 0) { - perror("rename"); + perror("mseq: rename"); exit(2); } |