chiark / gitweb /
Remove some dead code
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 30 Mar 2013 05:38:36 +0000 (01:38 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 31 Mar 2013 18:28:36 +0000 (14:28 -0400)
Based on coverity report.

src/bootchart/svg.c
src/core/dbus.c
src/libudev/libudev-util.c
src/shared/utmp-wtmp.c
src/timedate/timedated.c
src/udev/udevadm-trigger.c

index cd89689..0fb9fff 100644 (file)
@@ -823,9 +823,6 @@ static void svg_ps_bars(void) {
                 double starttime;
                 int t;
 
-                if (!ps)
-                        continue;
-
                 enc_name = xml_comment_encode(ps->name);
                 if(!enc_name)
                         continue;
index 62cbf89..b92c7d0 100644 (file)
@@ -978,9 +978,8 @@ static DBusConnection* manager_bus_connect_private(Manager *m, DBusBusType type)
         }
 
         return connection;
+
 fail:
-        if (connection)
-                dbus_connection_close(connection);
         dbus_error_free(&error);
         return NULL;
 }
index 44f6e4a..714dc50 100644 (file)
@@ -241,8 +241,7 @@ int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size)
                         return -EINVAL;
                 base[0] = '\0';
         }
-        if (base == NULL)
-                return -EINVAL;
+
         strscpyl(base, size - (base - syspath), "/", &link_target[back * 3], NULL);
         return 0;
 }
index 0a01809..c9b986f 100644 (file)
@@ -77,15 +77,11 @@ int utmp_get_runlevel(int *runlevel, int *previous) {
                 a = found->ut_pid & 0xFF;
                 b = (found->ut_pid >> 8) & 0xFF;
 
-                if (a < 0 || b < 0)
-                        r = -EIO;
-                else {
-                        *runlevel = a;
+                *runlevel = a;
+                if (previous)
+                        *previous = b;
 
-                        if (previous)
-                                *previous = b;
-                        r = 0;
-                }
+                r = 0;
         }
 
         endutxent();
index 16fffd0..1d4d739 100644 (file)
@@ -367,8 +367,6 @@ static int read_ntp(DBusConnection *bus) {
                         goto finish;
                 }
 
-                if (reply)
-                        dbus_message_unref(reply);
                 reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error);
                 if (!reply) {
                         if (streq(error.name, "org.freedesktop.DBus.Error.FileNotFound")) {
@@ -450,8 +448,6 @@ static int start_ntp(DBusConnection *bus, DBusError *error) {
                         goto finish;
                 }
 
-                if (reply)
-                        dbus_message_unref(reply);
                 reply = dbus_connection_send_with_reply_and_block(bus, m, -1, error);
                 if (!reply) {
                         if (streq(error->name, "org.freedesktop.DBus.Error.FileNotFound") ||
@@ -540,8 +536,6 @@ static int enable_ntp(DBusConnection *bus, DBusError *error) {
                         }
                 }
 
-                if (reply)
-                        dbus_message_unref(reply);
                 reply = dbus_connection_send_with_reply_and_block(bus, m, -1, error);
                 if (!reply) {
                         if (streq(error->name, "org.freedesktop.DBus.Error.FileNotFound")) {
index 9624c66..f472996 100644 (file)
@@ -214,7 +214,7 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[])
                 exec_list(udev_enumerate, action);
                 goto exit;
         default:
-                goto exit;
+                assert_not_reached("device_type");
         }
 exit:
         udev_enumerate_unref(udev_enumerate);