From 097b281ed3d653fc4851de7d44f9efbc15c9e7eb Mon Sep 17 00:00:00 2001 From: prozacx Date: Mon, 4 Apr 2005 04:21:55 +0000 Subject: [PATCH] Made --makepem use GetPemLocation() and print a message on success git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@96 726aef4b-f618-498e-8847-2d620e286838 --- main.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 7ac0fe52..b57e9004 100644 --- a/main.cpp +++ b/main.cpp @@ -97,13 +97,24 @@ int main(int argc, char** argv) { #ifdef HAVE_LIBSSL if ( bMakePem ) { - FILE *f = fopen( "znc.pem", "w" ); + CZNC* pZNC = CZNC::New(); + pZNC->InitDirs(""); + string sPemFile = pZNC->GetPemLocation(); + + FILE *f = fopen( sPemFile.c_str(), "w" ); + if ( !f ) { - cerr << "Unable to open znc.pem!" << endl; + cerr << "Unable to open pem file [" << sPemFile << "]" << endl; + delete pZNC; return( 1 ); } + CUtils::GenerateCert( f, bEncPem ); fclose( f ); + + cout << "Wrote pem file to [" << sPemFile << "]" << endl; + + delete pZNC; return( 0 ); } #endif /* HAVE_LIBSSL */ @@ -116,7 +127,6 @@ int main(int argc, char** argv) { } CZNC* pZNC = CZNC::New(); - pZNC->InitDirs(((argc) ? argv[0] : "")); if (!pZNC->ParseConfig(sConfig)) {