Add a trailing CRLF; the encoder doesn't.
authorrepka%netscape.com
Thu, 06 Apr 2000 00:15:54 +0000
changeset 226 9a87c11f500fdc3f8ce4b331c8df575448ea3366
parent 225 639c720d524a671a7b28e288cf36155ebb082494
child 227 c3cafdf20df33c8bfa61e546c20b083d8f2e10d7
push idunknown
push userunknown
push dateunknown
Add a trailing CRLF; the encoder doesn't.
security/nss/cmd/btoa/btoa.c
--- a/security/nss/cmd/btoa/btoa.c
+++ b/security/nss/cmd/btoa/btoa.c
@@ -89,17 +89,27 @@ encode_file(FILE *outFile, FILE *inFile)
 		break;
 	    }
 	}
 
 	status = NSSBase64Encoder_Update(cx, ibuf, nb);
 	if (status != SECSuccess) goto loser;
     }
 
-    return NSSBase64Encoder_Destroy(cx, PR_FALSE);
+    status = NSSBase64Encoder_Destroy(cx, PR_FALSE);
+    if (status != SECSuccess)
+	return status;
+
+    /*
+     * Add a trailing CRLF.  Note this must be done *after* the call
+     * to Destroy above (because only then are we sure all data has
+     * been written out).
+     */
+    fwrite("\r\n", 1, 2, outFile);
+    return SECSuccess;
 
   loser:
     (void) NSSBase64Encoder_Destroy(cx, PR_TRUE);
     return status;
 }
 
 static void Usage(char *progName)
 {