aboutsummaryrefslogtreecommitdiffstats
path: root/g10/plaintext.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/plaintext.c')
-rw-r--r--g10/plaintext.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/g10/plaintext.c b/g10/plaintext.c
index 377764833..d24c64015 100644
--- a/g10/plaintext.c
+++ b/g10/plaintext.c
@@ -546,17 +546,25 @@ hash_datafiles( gcry_md_hd_t md, gcry_md_hd_t md2, strlist_t files,
pfx = new_progress_context ();
if( !files ) {
- /* check whether we can open the signed material */
- fp = open_sigfile( sigfilename, pfx );
- if( fp ) {
- do_hash( md, md2, fp, textmode );
- iobuf_close(fp);
- release_progress_context (pfx);
- return 0;
- }
- log_error (_("no signed data\n"));
- release_progress_context (pfx);
- return gpg_error (GPG_ERR_NO_DATA);
+ /* Check whether we can open the signed material. We avoid
+ trying to open a file if run in batch mode. This assumed
+ data file for a sig file feature is just a convenience thing
+ for the command line and the user needs to read possible
+ warning messages. */
+ if (!opt.batch)
+ {
+ fp = open_sigfile( sigfilename, pfx );
+ if( fp )
+ {
+ do_hash( md, md2, fp, textmode );
+ iobuf_close(fp);
+ release_progress_context (pfx);
+ return 0;
+ }
+ }
+ log_error (_("no signed data\n"));
+ release_progress_context (pfx);
+ return gpg_error (GPG_ERR_NO_DATA);
}
@@ -615,7 +623,7 @@ hash_datafile_by_fd ( gcry_md_hd_t md, gcry_md_hd_t md2, int data_fd,
do_hash ( md, md2, fp, textmode);
iobuf_close(fp);
-
+
release_progress_context (pfx);
return 0;
}