From 44cd60e82077a8f90511b8534ee12cf3ff182ff9 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 22 Jun 2018 15:16:59 +0200 Subject: [PATCH] wifi/iwd: don't check return value for nm_utils_random_bytes() nm_utils_random_bytes() will always try its best to give some random numbers. A failure only means, that the kernel interfaces get_random() or /dev/urandom failed to provide good randomness. We don't really need good random numbers here, so no need to handle a failure. --- src/devices/wifi/nm-iwd-manager.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/devices/wifi/nm-iwd-manager.c b/src/devices/wifi/nm-iwd-manager.c index daa796cbb9..185384dc07 100644 --- a/src/devices/wifi/nm-iwd-manager.c +++ b/src/devices/wifi/nm-iwd-manager.c @@ -211,24 +211,17 @@ iwd_agent_export (GDBusConnection *connection, gpointer user_data, static const GDBusInterfaceVTable vtable = { .method_call = agent_dbus_method_cb, }; - gchar path[50]; unsigned int rnd; guint id; - if (!nm_utils_random_bytes (&rnd, sizeof (rnd))) { - g_set_error_literal (error, - NM_DEVICE_ERROR, - NM_DEVICE_ERROR_FAILED, - "Can't read urandom."); - return 0; - } + nm_utils_random_bytes (&rnd, sizeof (rnd)); nm_sprintf_buf (path, "/agent/%u", rnd); id = g_dbus_connection_register_object (connection, path, NM_UNCONST_PTR (GDBusInterfaceInfo, &iwd_agent_iface_info), - &vtable, user_data, NULL, error); + &vtable, user_data, NULL, error); if (id) *agent_path = g_strdup (path);