summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/libppp-plugin.c52
-rw-r--r--scripts/openconnect-script.c8
-rw-r--r--scripts/openvpn-script.c8
3 files changed, 34 insertions, 34 deletions
diff --git a/scripts/libppp-plugin.c b/scripts/libppp-plugin.c
index e77b8ccb..0dd8b471 100644
--- a/scripts/libppp-plugin.c
+++ b/scripts/libppp-plugin.c
@@ -2,7 +2,7 @@
*
* Connection Manager
*
- * 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
@@ -76,7 +76,7 @@ static void append(DBusMessageIter *dict, const char *key, const char *value)
}
-static int ppp_have_secret()
+static int ppp_have_secret(void)
{
return 1;
}
@@ -87,27 +87,27 @@ static int ppp_get_secret(char *username, char *password)
const char *user, *pass;
DBusError err;
- if (username == NULL && password == NULL)
+ if (!username && !password)
return -1;
- if (password == NULL)
+ if (!password)
return 1;
- if (connection == NULL)
+ if (!connection)
return -1;
dbus_error_init(&err);
msg = dbus_message_new_method_call(busname, path, interface, "getsec");
- if (msg == NULL)
+ if (!msg)
return -1;
dbus_message_append_args(msg, DBUS_TYPE_INVALID, DBUS_TYPE_INVALID);
reply = dbus_connection_send_with_reply_and_block(connection,
msg, -1, &err);
- if (reply == NULL) {
- if (dbus_error_is_set(&err) == TRUE)
+ if (!reply) {
+ if (dbus_error_is_set(&err))
dbus_error_free(&err);
dbus_message_unref(msg);
@@ -118,17 +118,17 @@ static int ppp_get_secret(char *username, char *password)
dbus_error_init(&err);
- if (dbus_message_get_args(reply, &err, DBUS_TYPE_STRING, &user,
- DBUS_TYPE_STRING, &pass,
- DBUS_TYPE_INVALID) == FALSE) {
- if (dbus_error_is_set(&err) == TRUE)
+ if (!dbus_message_get_args(reply, &err, DBUS_TYPE_STRING, &user,
+ DBUS_TYPE_STRING, &pass,
+ DBUS_TYPE_INVALID)) {
+ if (dbus_error_is_set(&err))
dbus_error_free(&err);
dbus_message_unref(reply);
return -1;
}
- if (username != NULL)
+ if (username)
strcpy(username, user);
strcpy(password, pass);
@@ -147,7 +147,7 @@ static void ppp_up(void *data, int arg)
DBusMessageIter iter, dict;
DBusMessage *msg;
- if (connection == NULL)
+ if (!connection)
return;
if (ipcp_gotoptions[0].ouraddr == 0)
@@ -155,7 +155,7 @@ static void ppp_up(void *data, int arg)
msg = dbus_message_new_method_call(busname, path,
interface, "notify");
- if (msg == NULL)
+ if (!msg)
return;
dbus_message_set_no_reply(msg, TRUE);
@@ -193,7 +193,7 @@ static void ppp_up(void *data, int arg)
if (ipcp_gotoptions[0].dnsaddr[1]) {
inet_ntop(AF_INET, &ipcp_gotoptions[0].dnsaddr[1],
buf, INET_ADDRSTRLEN);
- if (add_blank == TRUE)
+ if (add_blank)
strcat(dns, " ");
strcat(dns, buf);
@@ -214,22 +214,22 @@ static void ppp_up(void *data, int arg)
static void ppp_exit(void *data, int arg)
{
- if (connection != NULL) {
+ if (connection) {
dbus_connection_unref(connection);
connection = NULL;
}
- if (busname != NULL) {
+ if (busname) {
free(busname);
busname = NULL;
}
- if (interface != NULL) {
+ if (interface) {
free(interface);
interface = NULL;
}
- if (path != NULL) {
+ if (path) {
free(path);
path = NULL;
}
@@ -241,7 +241,7 @@ static void ppp_phase_change(void *data, int arg)
DBusMessage *msg;
int send_msg = 0;
- if (connection == NULL)
+ if (!connection)
return;
if (prev_phase == PHASE_AUTHENTICATE &&
@@ -253,7 +253,7 @@ static void ppp_phase_change(void *data, int arg)
if (send_msg > 0 || arg == PHASE_DEAD || arg == PHASE_DISCONNECT) {
msg = dbus_message_new_method_call(busname, path,
interface, "notify");
- if (msg == NULL)
+ if (!msg)
return;
dbus_message_set_no_reply(msg, TRUE);
@@ -282,21 +282,21 @@ int plugin_init(void)
inter = getenv("CONNMAN_INTERFACE");
p = getenv("CONNMAN_PATH");
- if (bus == NULL || inter == NULL || p == NULL)
+ if (!bus || !inter || !p)
return -1;
busname = strdup(bus);
interface = strdup(inter);
path = strdup(p);
- if (busname == NULL || interface == NULL || path == NULL) {
+ if (!busname || !interface || !path) {
ppp_exit(NULL, 0);
return -1;
}
connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
- if (connection == NULL) {
- if (dbus_error_is_set(&error) == TRUE)
+ if (!connection) {
+ if (dbus_error_is_set(&error))
dbus_error_free(&error);
ppp_exit(NULL, 0);
diff --git a/scripts/openconnect-script.c b/scripts/openconnect-script.c
index d6e42ebb..5e04144f 100644
--- a/scripts/openconnect-script.c
+++ b/scripts/openconnect-script.c
@@ -101,8 +101,8 @@ int main(int argc, char *argv[])
dbus_error_init(&error);
conn = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
- if (conn == NULL) {
- if (dbus_error_is_set(&error) == TRUE) {
+ if (!conn) {
+ if (dbus_error_is_set(&error)) {
print("%s", error.message);
dbus_error_free(&error);
} else
@@ -113,7 +113,7 @@ int main(int argc, char *argv[])
msg = dbus_message_new_method_call(busname, path,
interface, "notify");
- if (msg == NULL) {
+ if (!msg) {
dbus_connection_unref(conn);
print("Failed to allocate method call");
goto out;
@@ -137,7 +137,7 @@ int main(int argc, char *argv[])
dbus_message_iter_close_container(&iter, &dict);
- if (dbus_connection_send(conn, msg, NULL) == FALSE) {
+ if (!dbus_connection_send(conn, msg, NULL)) {
print("Failed to send message");
goto out;
}
diff --git a/scripts/openvpn-script.c b/scripts/openvpn-script.c
index f37eab2f..e703c867 100644
--- a/scripts/openvpn-script.c
+++ b/scripts/openvpn-script.c
@@ -90,8 +90,8 @@ int main(int argc, char *argv[])
dbus_error_init(&error);
conn = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
- if (conn == NULL) {
- if (dbus_error_is_set(&error) == TRUE) {
+ if (!conn) {
+ if (dbus_error_is_set(&error)) {
print("%s", error.message);
dbus_error_free(&error);
} else
@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
msg = dbus_message_new_method_call(busname, path,
interface, "notify");
- if (msg == NULL) {
+ if (!msg) {
dbus_connection_unref(conn);
print("Failed to allocate method call");
goto out;
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
dbus_message_iter_close_container(&iter, &dict);
- if (dbus_connection_send(conn, msg, NULL) == FALSE) {
+ if (!dbus_connection_send(conn, msg, NULL)) {
print("Failed to send message");
goto out;
}