From 82450170788ef8b57b7410209fe630ecc5fe1e18 Mon Sep 17 00:00:00 2001 From: Tigran Aivazian Date: Wed, 24 Oct 2012 23:22:21 +0100 Subject: [PATCH] Cleanups to extr.c and pdfattach 1. In extr.c the error message should use the correct full pathname, not the base filename. 2. In pdfattach the check for existence of input files should be replaced with the check for read access to them. --- extr.c | 2 +- utils/pdfattach | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extr.c b/extr.c index ccf7e211d..a202b103b 100644 --- a/extr.c +++ b/extr.c @@ -59,7 +59,7 @@ int save_attachments(int pageno, char *targetdir) sprintf(pathname, "%s/%s", targetdir, name); FILE *fout = fopen(pathname, "w"); if (!fout) { - fprintf(stderr, "extr: cannot write to file %s\n", name); + fprintf(stderr, "extr: cannot write to file %s\n", pathname); exit(1); } dump_stream(pdf_to_num(f_obj), fout); diff --git a/utils/pdfattach b/utils/pdfattach index 73f81f02f..1bd7ab18d 100755 --- a/utils/pdfattach +++ b/utils/pdfattach @@ -67,7 +67,7 @@ numargs=$# for ((i=1 ; i <= $numargs ; i++)) do fullname=$(readlink -f "$1") - if [ ! -f "$fullname" ] ; then + if [ ! -r "$fullname" ] ; then echo "$progname: file \"$fullname\" does not exist" >&2 usage fi