From fc5ab33805304772d7cac2c1771e01ceae436327 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Fri, 4 Feb 2011 14:54:26 +0200 Subject: [PATCH] =?utf8?q?=D0=94=D0=BE=D0=B4=D0=B0=D0=BD=D0=BE=20=D0=BF?= =?utf8?q?=D0=B0=D1=82=D1=87=20=D0=B2=D1=96=D0=B4=20Alexey=20Osipov=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Виправлено читання конфігураційного файлу консольного авторизатора за замовчуванням --- projects/sgauth/main.cpp | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/projects/sgauth/main.cpp b/projects/sgauth/main.cpp index c7b2bfdc..cdda3cb9 100644 --- a/projects/sgauth/main.cpp +++ b/projects/sgauth/main.cpp @@ -360,7 +360,7 @@ if (clnp->GetAuthorized()) { cout << "Connect" << endl; clnp->Connect(); - } + } } //----------------------------------------------------------------------------- void CatchUSR2(int) @@ -416,9 +416,6 @@ return; //----------------------------------------------------------------------------- int main(int argc, char *argv[]) { -//int port; -//char *endptr; - SETTINGS settings; #ifndef WIN32 @@ -428,13 +425,6 @@ if(0) #endif { settings.SetConfFile(argv[1]); - if (settings.ReadSettings()) - { - printf("ReadSettingsError\n"); - printf("%s\n", settings.GetStrError().c_str()); - exit(-1); - } - settings.Print(); } else { @@ -457,7 +447,13 @@ else }*/ } -//settings.Print(); +if (settings.ReadSettings()) + { + printf("ReadSettingsError\n"); + printf("%s\n", settings.GetStrError().c_str()); + exit(-1); + } +settings.Print(); #ifndef WIN32 if (settings.GetDaemon()) @@ -468,22 +464,19 @@ if (settings.GetDaemon()) switch (fork()) { - case -1: // ìÁÖÁ + case -1: exit(1); break; - case 0: // ðÏÔÏÍÏË + case 0: setsid(); break; - default: // ïÓÎÏ×ÎÏÊ ÐÒÏÃÅÓÓ + default: exit(0); break; } } - - - #endif clnp = new IA_CLIENT_PROT(settings.GetServerName(), settings.GetServerPort(), settings.GetLocalPort()); @@ -506,7 +499,6 @@ clnp->SetDirNameCb(SetDirName, NULL); clnp->SetStatChangedCb(StatUpdate, NULL); clnp->SetReconnect(settings.GetReconnect()); - clnp->Start(); SetSignalHandlers(); @@ -568,5 +560,3 @@ while (1) return 0; } //----------------------------------------------------------------------------- - - -- 2.44.2