gnupg/g10 (ChangeLog encode.c plaintext.c progress.c sign.c)

cvs user dshaw cvs at cvs.gnupg.org
Thu Nov 4 23:23:52 CET 2004


    Date: Thursday, November 4, 2004 @ 23:28:39
  Author: dshaw
    Path: /cvs/gnupg/gnupg/g10

Modified: ChangeLog encode.c plaintext.c progress.c sign.c

* plaintext.c (handle_plaintext): Don't try and create a zero-length
filename when using --use-embedded-filename with input that has no
filename (clearsigned or message generated from a pipe).

* encode.c (encode_simple, encode_crypt), progress.c (handle_progress),
sign.c (write_plaintext_packet): Fix a few inconsistent calls (NULL
filename means a pipe here, so don't bother to check it twice).


-------------+
 ChangeLog   |   12 ++++++++++++
 encode.c    |   16 ++++++++--------
 plaintext.c |    5 +++--
 progress.c  |    2 +-
 sign.c      |   14 +++++++-------
 5 files changed, 31 insertions(+), 18 deletions(-)


Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.637 gnupg/g10/ChangeLog:1.638
--- gnupg/g10/ChangeLog:1.637	Wed Nov  3 21:35:28 2004
+++ gnupg/g10/ChangeLog	Thu Nov  4 23:28:39 2004
@@ -1,3 +1,15 @@
+2004-11-04  David Shaw  <dshaw at jabberwocky.com>
+
+	* plaintext.c (handle_plaintext): Don't try and create a
+	zero-length filename when using --use-embedded-filename with input
+	that has no filename (clearsigned or message generated from a
+	pipe).
+
+	* encode.c (encode_simple, encode_crypt), progress.c
+	(handle_progress), sign.c (write_plaintext_packet): Fix a few
+	inconsistent calls (NULL filename means a pipe here, so don't
+	bother to check it twice).
+
 2004-11-03  David Shaw  <dshaw at jabberwocky.com>
 
 	* misc.c (print_digest_algo_note): The latest 2440bis drafts
Index: gnupg/g10/encode.c
diff -u gnupg/g10/encode.c:1.92 gnupg/g10/encode.c:1.93
--- gnupg/g10/encode.c:1.92	Wed Oct 13 20:10:06 2004
+++ gnupg/g10/encode.c	Thu Nov  4 23:28:39 2004
@@ -300,8 +300,8 @@
        either partial length or fixed length with the new style
        messages. */
 
-    if ( !iobuf_is_pipe_filename (filename) && filename && *filename 
-         && !opt.textmode ) {
+    if ( !iobuf_is_pipe_filename (filename) && *filename && !opt.textmode )
+      {
         off_t tmpsize;
 
 	if ( !(tmpsize = iobuf_get_filelength(inp)) )
@@ -314,9 +314,9 @@
           filesize = tmpsize;
         else
           filesize = 0;
-    }
+      }
     else
-	filesize = opt.set_filesize ? opt.set_filesize : 0; /* stdin */
+      filesize = opt.set_filesize ? opt.set_filesize : 0; /* stdin */
 
     if (!opt.no_literal) {
 	pt->timestamp = make_timestamp();
@@ -596,8 +596,8 @@
 	}
     }
 
-    if (!iobuf_is_pipe_filename (filename) && *filename 
-        && !opt.textmode ) {
+    if (!iobuf_is_pipe_filename (filename) && *filename && !opt.textmode )
+      {
         off_t tmpsize;
 
 	if ( !(tmpsize = iobuf_get_filelength(inp)) )
@@ -610,9 +610,9 @@
           filesize = tmpsize;
         else
           filesize = 0;
-    }
+      }
     else
-	filesize = opt.set_filesize ? opt.set_filesize : 0; /* stdin */
+      filesize = opt.set_filesize ? opt.set_filesize : 0; /* stdin */
 
     if (!opt.no_literal) {
 	pt->timestamp = make_timestamp();
Index: gnupg/g10/plaintext.c
diff -u gnupg/g10/plaintext.c:1.58 gnupg/g10/plaintext.c:1.59
--- gnupg/g10/plaintext.c:1.58	Thu Oct 28 05:57:30 2004
+++ gnupg/g10/plaintext.c	Thu Nov  4 23:28:39 2004
@@ -105,13 +105,14 @@
 
     if( nooutput )
 	;
-    else if ( iobuf_is_pipe_filename (fname) ) {
+    else if ( iobuf_is_pipe_filename (fname) || !*fname)
+      {
 	/* No filename or "-" given; write to stdout. */
 	fp = stdout;
 #ifdef HAVE_DOSISH_SYSTEM
 	setmode ( fileno(fp) , O_BINARY );
 #endif
-    }
+      }
     else {
 	while( !overwrite_filep (fname) ) {
             char *tmp = ask_outfile_name (NULL, 0);
Index: gnupg/g10/progress.c
diff -u gnupg/g10/progress.c:1.5 gnupg/g10/progress.c:1.6
--- gnupg/g10/progress.c:1.5	Wed Oct 13 11:59:44 2004
+++ gnupg/g10/progress.c	Thu Nov  4 23:28:39 2004
@@ -105,7 +105,7 @@
   if (!is_status_enabled ())
     return;
 
-  if ( !iobuf_is_pipe_filename (name) && name && *name )
+  if ( !iobuf_is_pipe_filename (name) && *name )
     filesize = iobuf_get_filelength (inp);
   else if (opt.set_filesize)
     filesize = opt.set_filesize;
Index: gnupg/g10/sign.c
diff -u gnupg/g10/sign.c:1.134 gnupg/g10/sign.c:1.135
--- gnupg/g10/sign.c:1.134	Fri Oct 29 00:09:09 2004
+++ gnupg/g10/sign.c	Thu Nov  4 23:28:39 2004
@@ -543,11 +543,12 @@
     }
 
     /* try to calculate the length of the data */
-    if ( !iobuf_is_pipe_filename (fname) && fname && *fname ) {
+    if ( !iobuf_is_pipe_filename (fname) && *fname )
+      {
         off_t tmpsize;
        
         if( !(tmpsize = iobuf_get_filelength(inp)) )
-            log_info (_("WARNING: `%s' is an empty file\n"), fname);
+	  log_info (_("WARNING: `%s' is an empty file\n"), fname);
 
         /* We can't encode the length of very large files because
            OpenPGP uses only 32 bit for file sizes.  So if the size of
@@ -563,11 +564,10 @@
          * without a double read of the file - to avoid that
          * we simple use partial length packets. */
         if ( ptmode == 't' )
-            filesize = 0;
-    }
-    else {
-        filesize = opt.set_filesize? opt.set_filesize : 0; /* stdin */
-    }
+	  filesize = 0;
+      }
+    else
+      filesize = opt.set_filesize? opt.set_filesize : 0; /* stdin */
 
     if (!opt.no_literal) {
         PACKET pkt;




More information about the Gnupg-commits mailing list