DA: Modify DHCP request retries count
[platform/upstream/connman.git] / scripts / openvpn-script.c
old mode 100644 (file)
new mode 100755 (executable)
index e359c31..6ba0d29
@@ -3,7 +3,7 @@
  *  Connection Manager
  *
  *  Copyright (C) 2007-2012  Intel Corporation. All rights reserved.
- *  Copyright (C) 2010  BMW Car IT GmbH. All rights reserved.
+ *  Copyright (C) 2010,2012-2014  BMW Car IT GmbH.
  *
  *  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
@@ -43,7 +43,6 @@ static void print(const char *format, ...)
        va_end(ap);
 }
 
-
 static void append(DBusMessageIter *dict, const char *pattern)
 {
        DBusMessageIter entry;
@@ -84,15 +83,17 @@ int main(int argc, char *argv[])
        reason = getenv("script_type");
 
        if (!busname || !interface || !path || !reason) {
-               print("Required environment variables not set");
+               print("Required environment variables not set; "
+                       "bus=%s iface=%s path=%s reason=%s",
+                       busname, interface, path, reason);
                ret = 1;
                goto out;
        }
        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
@@ -103,7 +104,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;
@@ -127,7 +128,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;
        }