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.
This commit is contained in:
Thomas Haller 2018-06-22 15:16:59 +02:00
parent f11246154e
commit 44cd60e820

View file

@ -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);