summaryrefslogtreecommitdiff
path: root/vpn/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'vpn/main.c')
-rw-r--r--vpn/main.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/vpn/main.c b/vpn/main.c
index d72fa74c..ee88aacd 100644
--- a/vpn/main.c
+++ b/vpn/main.c
@@ -2,7 +2,7 @@
*
* ConnMan VPN daemon
*
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ * Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -84,14 +84,14 @@ static void parse_config(GKeyFile *config, const char *file)
GError *error = NULL;
int timeout;
- if (config == NULL)
+ if (!config)
return;
DBG("parsing %s", file);
timeout = g_key_file_get_integer(config, "General",
"InputRequestTimeout", &error);
- if (error == NULL && timeout >= 0)
+ if (!error && timeout >= 0)
connman_vpn_settings.timeout_inputreq = timeout * 1000;
g_clear_error(&error);
@@ -103,7 +103,7 @@ static int config_init(const char *file)
config = load_config(file);
parse_config(config, file);
- if (config != NULL)
+ if (config)
g_key_file_free(config);
return 0;
@@ -188,11 +188,11 @@ static gchar *option_config = NULL;
static gchar *option_debug = NULL;
static gchar *option_plugin = NULL;
static gchar *option_noplugin = NULL;
-static gboolean option_detach = TRUE;
-static gboolean option_version = FALSE;
-static gboolean option_routes = FALSE;
+static bool option_detach = true;
+static bool option_version = false;
+static bool option_routes = false;
-static gboolean parse_debug(const char *key, const char *value,
+static bool parse_debug(const char *key, const char *value,
gpointer user_data, GError **error)
{
if (value)
@@ -200,7 +200,7 @@ static gboolean parse_debug(const char *key, const char *value,
else
option_debug = g_strdup("*");
- return TRUE;
+ return true;
}
static GOptionEntry options[] = {
@@ -244,8 +244,8 @@ int main(int argc, char *argv[])
context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, options, NULL);
- if (g_option_context_parse(context, &argc, &argv, &error) == FALSE) {
- if (error != NULL) {
+ if (!g_option_context_parse(context, &argc, &argv, &error)) {
+ if (error) {
g_printerr("%s\n", error->message);
g_error_free(error);
} else
@@ -255,19 +255,19 @@ int main(int argc, char *argv[])
g_option_context_free(context);
- if (option_version == TRUE) {
+ if (option_version) {
printf("%s\n", VERSION);
exit(0);
}
- if (option_detach == TRUE) {
+ if (option_detach) {
if (daemon(0, 0)) {
perror("Can't start daemon");
exit(1);
}
}
- if (mkdir(STATEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
+ if (mkdir(VPN_STATEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) < 0) {
if (errno != EEXIST)
perror("Failed to create state directory");
@@ -298,8 +298,8 @@ int main(int argc, char *argv[])
dbus_error_init(&err);
conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, VPN_SERVICE, &err);
- if (conn == NULL) {
- if (dbus_error_is_set(&err) == TRUE) {
+ if (!conn) {
+ if (dbus_error_is_set(&err)) {
fprintf(stderr, "%s\n", err.message);
dbus_error_free(&err);
} else
@@ -309,11 +309,11 @@ int main(int argc, char *argv[])
g_dbus_set_disconnect_function(conn, disconnect_callback, NULL, NULL);
- __connman_log_init(argv[0], option_debug, option_detach, FALSE,
+ __connman_log_init(argv[0], option_debug, option_detach, false,
"Connection Manager VPN daemon", VERSION);
__connman_dbus_init(conn);
- if (option_config == NULL)
+ if (!option_config)
config_init(CONFIGMAINFILE);
else
config_init(option_config);
@@ -347,7 +347,7 @@ int main(int argc, char *argv[])
__connman_agent_cleanup();
__connman_inotify_cleanup();
__connman_dbus_cleanup();
- __connman_log_cleanup(FALSE);
+ __connman_log_cleanup(false);
dbus_connection_unref(conn);