Commit fef2c7fb authored by Daniel Lenski's avatar Daniel Lenski

defer the switch to syslog until AFTER the tunnel is fully up,

This way, initial connection information and background PID will be usefully
printed to the console, as will errors which prevent the tunnel from being
started (and thus cause OpenConnect to abort as soon as it's established
a connection to the server).

This is a further refinement of 557ac6cf (!117).
Signed-off-by: default avatarDaniel Lenski <dlenski@gmail.com>
parent b156b581
......@@ -82,6 +82,7 @@ static int verbose = PRG_INFO;
static int timestamp;
#ifndef _WIN32
static int background;
static int use_syslog = 0;
static FILE *pid_fp = NULL;
static char *pidfile = NULL;
#endif
......@@ -1506,7 +1507,14 @@ static void fully_up_cb(void *_vpninfo) {
#ifndef _WIN32
if (background)
pid_fp = background_self(vpninfo, pidfile);
#endif
#ifndef __native_client__
if (use_syslog) {
openlog("openconnect", LOG_PID, LOG_DAEMON);
vpninfo->progress = syslog_progress;
}
#endif /* !__native_client__ */
#endif /* !_WIN32 */
}
int main(int argc, char **argv)
......@@ -1531,7 +1539,6 @@ int main(int argc, char **argv)
#ifndef _WIN32
struct sigaction sa;
struct utsname utsbuf;
int use_syslog = 0;
#endif
#ifdef ENABLE_NLS
......@@ -2068,13 +2075,6 @@ int main(int argc, char **argv)
}
#if !defined(_WIN32) && !defined(__native_client__)
if (use_syslog) {
openlog("openconnect", LOG_PID, LOG_DAEMON);
vpninfo->progress = syslog_progress;
}
#endif /* !_WIN32 && !__native_client__ */
if (!vpninfo->vpnc_script) {
vpn_progress(vpninfo, PRG_INFO,
_("No --script argument provided; DNS and routing are not configured\n"));
......
......@@ -226,7 +226,7 @@ Use
for tunnel interface
.TP
.B \-l,\-\-syslog
Use syslog for progress messages
After tunnel is brought up, use syslog for further progress messages
.TP
.B \-\-timestamp
Prepend a timestamp to each progress message
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment