Skip to content

Commit

Permalink
Change verbosity with SIGUSR[12]
Browse files Browse the repository at this point in the history
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Oct 19, 2009
1 parent dacb3eb commit 9dabc73
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions main.c
Expand Up @@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
Expand Down Expand Up @@ -150,11 +151,19 @@ static void read_stdin(char **string)
if (c)
*c = 0;
}
static void handle_sigusr(int sig)
{
if (sig == SIGUSR1)
verbose = PRG_TRACE;
else if (sig == SIGUSR2)
verbose = PRG_INFO;
}

int main(int argc, char **argv)
{
struct openconnect_info *vpninfo;
struct utsname utsbuf;
struct sigaction sa;
int cookieonly = 0;
int use_syslog = 0;
uid_t uid = getuid();
Expand Down Expand Up @@ -369,6 +378,11 @@ int main(int argc, char **argv)
} else {
vpninfo->progress = write_progress;
}
memset(&sa, 0, sizeof(sa));
sa.sa_handler = handle_sigusr;

sigaction(SIGUSR1, &sa, NULL);
sigaction(SIGUSR2, &sa, NULL);

if (vpninfo->sslkey && do_passphrase_from_fsid)
passphrase_from_fsid(vpninfo);
Expand Down

0 comments on commit 9dabc73

Please sign in to comment.