From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 3CF601580B9 for ; Mon, 23 Aug 2021 16:06:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 634F3E0A0B; Mon, 23 Aug 2021 16:06:57 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 31A1CE0A0B for ; Mon, 23 Aug 2021 16:06:57 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C3BA1335DBF for ; Mon, 23 Aug 2021 16:06:55 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7E1BC7B2 for ; Mon, 23 Aug 2021 16:06:54 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1629734809.226a9f4dedae29d22e333c215d32d25292da0a78.blueness@gentoo> Subject: [gentoo-commits] proj/eudev:master commit in: src/udev/ X-VCS-Repository: proj/eudev X-VCS-Files: src/udev/udev-event.c X-VCS-Directories: src/udev/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: 226a9f4dedae29d22e333c215d32d25292da0a78 X-VCS-Branch: master Date: Mon, 23 Aug 2021 16:06:54 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 17cd1ac0-1d7a-4b1d-85d2-08a77acb79f9 X-Archives-Hash: db57af7daecbad61a6e9767db02b7139 commit: 226a9f4dedae29d22e333c215d32d25292da0a78 Author: Anthony G. Basile gentoo org> AuthorDate: Mon Aug 23 16:06:49 2021 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Mon Aug 23 16:06:49 2021 +0000 URL: https://gitweb.gentoo.org/proj/eudev.git/commit/?id=226a9f4d src/udev/udev-event.c: clean up whitespaces Signed-off-by: Anthony G. Basile gentoo.org> src/udev/udev-event.c | 72 +++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index 64cc69cbc..1c1b0d273 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -813,7 +813,7 @@ static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char * int sk; struct ifreq ifr; - log_debug("changing net interface name from '%s' to '%s'\n",oldname,name); + log_debug("changing net interface name from '%s' to '%s'\n",oldname,name); sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) @@ -825,61 +825,61 @@ static int rename_netif_dev_fromname_toname(struct udev_device *dev,const char * r = ioctl(sk, SIOCSIFNAME, &ifr); #ifdef ENABLE_RULE_GENERATOR - int loop; + int loop; struct ifreq ifr_tmp; - if (r == 0) { - log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname); - goto out; - } - /* keep trying if the destination interface name already exists */ - log_debug("collision on rename of network interface %s to %s , retrying until timeout\n", - ifr.ifr_name, ifr.ifr_newname); + if (r == 0) { + log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname); + goto out; + } + /* keep trying if the destination interface name already exists */ + log_debug("collision on rename of network interface %s to %s , retrying until timeout\n", + ifr.ifr_name, ifr.ifr_newname); - /* there has been a collision so rename my name to a temporal name, letting other one to rename to my name, freeying its name... */ + /* there has been a collision so rename my name to a temporal name, letting other one to rename to my name, freeying its name... */ memzero(&ifr_tmp, sizeof(struct ifreq)); strscpy(ifr_tmp.ifr_name, IFNAMSIZ, oldname); - snprintf(ifr_tmp.ifr_newname, IFNAMSIZ, "rename_%s", oldname); + snprintf(ifr_tmp.ifr_newname, IFNAMSIZ, "rename_%s", oldname); r = ioctl(sk, SIOCSIFNAME, &ifr_tmp); - log_info("Temporarily renamed network interface %s to %s\n", ifr_tmp.ifr_name, ifr_tmp.ifr_newname); - - /* we have changed our name so in subsequents tries i should rename my temporal name to the wanted one */ + log_info("Temporarily renamed network interface %s to %s\n", ifr_tmp.ifr_name, ifr_tmp.ifr_newname); + + /* we have changed our name so in subsequents tries i should rename my temporal name to the wanted one */ strscpy(ifr.ifr_name, IFNAMSIZ, ifr_tmp.ifr_newname); - r = -errno; - if (r != -EEXIST) - goto out; + r = -errno; + if (r != -EEXIST) + goto out; - /* wait a maximum of 90 seconds for our target to become available */ - loop = 90 * 20; - while (loop--) { - const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 }; + /* wait a maximum of 90 seconds for our target to become available */ + loop = 90 * 20; + while (loop--) { + const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 }; - nanosleep(&duration, NULL); + nanosleep(&duration, NULL); - r = ioctl(sk, SIOCSIFNAME, &ifr); - if (r == 0) { - log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname); - break; - } - r = -errno; - if (r != -EEXIST) - break; - } + r = ioctl(sk, SIOCSIFNAME, &ifr); + if (r == 0) { + log_info("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname); + break; + } + r = -errno; + if (r != -EEXIST) + break; + } out: #endif - if (r < 0) + if (r < 0) log_error_errno(-errno, "Error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname); - else - log_debug("renamed network interface '%s' to '%s'", oldname, name); + else + log_debug("renamed network interface '%s' to '%s'", oldname, name); close(sk); return r; } static int rename_netif(struct udev_event *event) { - return rename_netif_dev_fromname_toname(event->dev,udev_device_get_sysname(event->dev),event->name); + return rename_netif_dev_fromname_toname(event->dev,udev_device_get_sysname(event->dev),event->name); } void udev_event_execute_rules(struct udev_event *event, @@ -944,7 +944,7 @@ void udev_event_execute_rules(struct udev_event *event, */ #ifdef ENABLE_RULE_GENERATOR - int r; + int r; if (udev_device_get_ifindex(dev) > 0 && streq(udev_device_get_action(dev), "add") && (event->name == NULL && (r=udev_rules_assigning_name_to(rules,udev_device_get_sysname(dev))) > 0 || event->name != NULL && !streq(event->name, udev_device_get_sysname(dev)))) {