mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 09:50:17 +01:00
device: don't limit try count in nm_device_ethernet_utils_get_default_wired_name()
The limit of trying up to 10000 was arbitrary. In practice, we are not expected that we need that many searches. If that would be the case (and we would have 10000 conflicting connections that take all the names), then we anyway would need to refactor the code not to scale with O(n^2). Replace the arbitrary limit with an even larger one. The new limit is so large that in practice it's impossible to reach it.
This commit is contained in:
parent
72de0afa35
commit
3a99c343d8
1 changed files with 1 additions and 2 deletions
|
|
@ -32,7 +32,7 @@ nm_device_ethernet_utils_get_default_wired_name (NMConnection *const *connection
|
|||
int i;
|
||||
|
||||
/* Find the next available unique connection name */
|
||||
for (i = 1; i <= 10000; i++) {
|
||||
for (i = 1; i <= G_MAXINT; i++) {
|
||||
temp = g_strdup_printf (_("Wired connection %d"), i);
|
||||
for (j = 0; connections[j]; j++) {
|
||||
if (nm_streq0 (nm_connection_get_id (connections[j]), temp)) {
|
||||
|
|
@ -44,7 +44,6 @@ nm_device_ethernet_utils_get_default_wired_name (NMConnection *const *connection
|
|||
next:
|
||||
;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue