From 5a3d303bc95dfa87631e5dfc6d538aed6cdf04d3 Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Fri, 6 Sep 2002 03:52:49 +0000 Subject: [PATCH] Bug 136804: initialize inFile to PR_STDIN instead of NULL so that we don't crash if the -i option is not specified. Added two assertions to avoid closing PR_STDIN due to internal errors. --- security/nss/cmd/certutil/certutil.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/security/nss/cmd/certutil/certutil.c b/security/nss/cmd/certutil/certutil.c index 0d7caafe522b..6b154f94465c 100644 --- a/security/nss/cmd/certutil/certutil.c +++ b/security/nss/cmd/certutil/certutil.c @@ -2161,7 +2161,7 @@ main(int argc, char **argv) CERTCertDBHandle *certHandle; PK11SlotInfo *slot = NULL; CERTName * subject = 0; - PRFileDesc *inFile = 0; + PRFileDesc *inFile = PR_STDIN; PRFileDesc *outFile = 0; char * certfile = "tempcert"; char * certreqfile = "tempcertreq"; @@ -2693,6 +2693,7 @@ main(int argc, char **argv) */ if (certutil.commands[cmd_CreateAndAddCert].activated) { + PORT_Assert(inFile != PR_STDIN); PR_Close(inFile); PR_Close(outFile); inFile = PR_Open(certfile, PR_RDONLY, 0); @@ -2717,6 +2718,7 @@ main(int argc, char **argv) } if (certutil.commands[cmd_CreateAndAddCert].activated) { + PORT_Assert(inFile != PR_STDIN); PR_Close(inFile); PR_Delete(certfile); PR_Delete(certreqfile);