Compare commits
10 Commits
6868ca3969
...
5d2ad57fa1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d2ad57fa1 | ||
|
|
57e21a3868 | ||
|
|
517b58c2ca | ||
|
|
346e257336 | ||
|
|
60d9625613 | ||
|
|
7328c9ba45 | ||
|
|
859f48b588 | ||
|
|
9331bf4b64 | ||
|
|
f8dc26bd4e | ||
|
|
da387a0e26 |
@ -0,0 +1,65 @@
|
||||
From a8212c1b232a902938d0e5ea6a82bd6ae52e861c Mon Sep 17 00:00:00 2001
|
||||
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
|
||||
Date: Wed, 6 Mar 2019 04:25:00 +0800
|
||||
Subject: [PATCH] ifup-eth: add a new PERSISTENT_DHCLIENT_IPV6 option for IPv6
|
||||
dhclient daemon
|
||||
|
||||
In 76226a34 ("ifup-eth: apply PERSISTENT_DHCLIENT to IPv6 dhclient daemon"),
|
||||
one PERSISTENT_DHCLIENT option works for both IPv4 and IPv6, so the IPv4
|
||||
and IPv6 settings are consistent. However, the user settings for IPv4 and IPv6
|
||||
are limited.
|
||||
|
||||
For example, users try to adopt both IPv4 and IPv6 protocol. DHCPv6 servers
|
||||
may be not stable as DHCP servers, thus the expectation for obtaining IPv6
|
||||
address is lower than IPv4 address. For users, IPv4 address must be
|
||||
obtained for the basic communication. So the PERSISTENT_DHCLIENT option is
|
||||
set to be "yes | 1" for IPv4 address. However, the network service may be
|
||||
stuck until it fails due to missing DHCPv6 servers, and the remaining devices also
|
||||
cannot obtain both IPv4 and IPv6 addresses. The problem is very serious for users.
|
||||
|
||||
Here, I add a new PERSISTENT_DHCLIENT_IPV6 option only for IPv6 dhclient daemon,
|
||||
so users can set IPv4 and IPv6 separately.
|
||||
|
||||
Fixes: 76226a3 ("ifup-eth: apply PERSISTENT_DHCLIENT to IPv6 dhclient daemon")
|
||||
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
|
||||
---
|
||||
doc/sysconfig.txt | 9 +++++++++
|
||||
network-scripts/ifup-eth | 2 +-
|
||||
2 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/doc/sysconfig.txt b/doc/sysconfig.txt
|
||||
index 0d9abbdf..ebd1f2fb 100644
|
||||
--- a/doc/sysconfig.txt
|
||||
+++ b/doc/sysconfig.txt
|
||||
@@ -604,6 +604,15 @@ Files in /etc/sysconfig/network-scripts/
|
||||
By default network-scripts will set `accept_ra` only if $IPV6_AUTOCONF is
|
||||
set to `yes`. If you don't want SLAAC addresses but do want to accept RA,
|
||||
then set this to `yes`. Defaults to `no`.
|
||||
+ PERSISTENT_DHCLIENT_IPV6=yes|no|1|0
|
||||
+ Without this option, or if it is 'no'/'0', and DHCPV6C=yes,
|
||||
+ 'dhclient -6' is run for the interface in "one-shot" mode; if the
|
||||
+ DHCPv6 server does not respond for a configurable timeout, then
|
||||
+ 'dhclient -6' exits and the interface is not brought up -
|
||||
+ the '-1' option is given to 'dhclient -6'.
|
||||
+ If PERSISTENT_DHCLIENT_IPV6=yes, then dhclient will keep on trying
|
||||
+ to contact the DHCPv6 server when it does not respond - no '-1'
|
||||
+ option is given to 'dhclienti -6'.
|
||||
|
||||
Special configuration options for multi-homed hosts etc.
|
||||
IPV6_ROUTER=yes|no: Controls IPv6 autoconfiguration
|
||||
diff --git a/network-scripts/ifup-eth b/network-scripts/ifup-eth
|
||||
index 2f58d195..a4c0d2b4 100755
|
||||
--- a/network-scripts/ifup-eth
|
||||
+++ b/network-scripts/ifup-eth
|
||||
@@ -365,7 +365,7 @@ if is_true "${DHCPV6C}" && [ -x /sbin/dhclient ]; then
|
||||
echo -n $"Determining IPv6 information for ${DEVICE}..."
|
||||
|
||||
# Initialize the dhclient args for IPv6 and obtain the hostname options if needed:
|
||||
- if is_true "${PERSISTENT_DHCLIENT}"; then
|
||||
+ if is_true "${PERSISTENT_DHCLIENT_IPV6}"; then
|
||||
ONESHOT="";
|
||||
else
|
||||
ONESHOT="-1";
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
From: wangxiao <wangxiao65@huawei.com>
|
||||
Subject: [PATCH] initscripts: maintain permissions set umask in case resolvconf doesn't exist
|
||||
reason: maintain permissions set umask in case resolvconf doesn't exist
|
||||
diff --git a/network-scripts/network-functions b/network-scripts/network-functions
|
||||
index 7f5dfb0..8deda57 100644
|
||||
--- a/network-scripts/network-functions
|
||||
+++ b/network-scripts/network-functions
|
||||
@@ -619,6 +619,11 @@
|
||||
# Invoke this when /etc/resolv.conf has changed:
|
||||
change_resolv_conf ()
|
||||
{
|
||||
+ # maintain permissions
|
||||
+ # but set umask in case it doesn't exist!
|
||||
+ oldumask=$(umask)
|
||||
+ umask 022
|
||||
+
|
||||
s=$(/bin/grep '^[\ \ ]*option' /etc/resolv.conf 2>/dev/null)
|
||||
if [ $# -gt 1 ]; then
|
||||
if [ "x$s" != "x" ]; then
|
||||
@@ -654,6 +659,8 @@
|
||||
/usr/bin/logger -p local7.notice -t "NET" -i "$0 : updated /etc/resolv.conf"
|
||||
[ -e /run/nscd/socket ] && /usr/sbin/nscd -i hosts # invalidate cache
|
||||
fi
|
||||
+
|
||||
+ umask $oldumask
|
||||
return $r
|
||||
}
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
From df22ec994da59550f065dbd4bc6b554f789f3ed0 Mon Sep 17 00:00:00 2001
|
||||
From: rpm-build <rpm-build>
|
||||
Date: Tue, 3 Mar 2020 11:49:58 +0800
|
||||
Subject: [PATCH] initscripts: adapt to GREP command line
|
||||
|
||||
Type:bugfix
|
||||
CVE:
|
||||
Signed-off-by: zhanglu <zhanglu37@huawei.com>
|
||||
---
|
||||
etc/rc.d/init.d/network | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/etc/rc.d/init.d/network b/etc/rc.d/init.d/network
|
||||
index f69948e..069442f 100755
|
||||
--- a/etc/rc.d/init.d/network
|
||||
+++ b/etc/rc.d/init.d/network
|
||||
@@ -132,7 +132,7 @@ start)
|
||||
continue
|
||||
fi
|
||||
|
||||
- if LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i > /dev/null ; then
|
||||
+ if ! LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i > /dev/null ; then
|
||||
# this loads the module, to preserve ordering
|
||||
is_available $i
|
||||
continue
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -1,80 +0,0 @@
|
||||
From d6af590090a2a8ffd45e273bdbd46a3fefc8debb Mon Sep 17 00:00:00 2001
|
||||
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
|
||||
Date: Mon, 22 Jul 2019 13:38:55 +0800
|
||||
Subject: [PATCH] ifup/ifdown: print DEPRECATION_WARNING_ISSUED waring info
|
||||
after source_config
|
||||
|
||||
In ifup/ifdown scripts, move deprecation waring info after
|
||||
source_config, so users can config DEPRECATION_WARNING_ISSUED in
|
||||
ifcfg-** file to decide whether show deprecation waring info when
|
||||
calling ifup/ifdown.
|
||||
|
||||
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
|
||||
---
|
||||
network-scripts/ifdown | 12 ++++++------
|
||||
network-scripts/ifup | 12 ++++++------
|
||||
2 files changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/network-scripts/ifdown b/network-scripts/ifdown
|
||||
index aa8fce7..ec05891 100755
|
||||
--- a/network-scripts/ifdown
|
||||
+++ b/network-scripts/ifdown
|
||||
@@ -16,12 +16,6 @@ CONFIG=$1
|
||||
exit 1
|
||||
}
|
||||
|
||||
-if ! is_true ${DEPRECATION_WARNING_ISSUED}; then
|
||||
- net_log $"You are using 'ifdown' script provided by 'network-scripts', which are now deprecated." warning ifdown >&2
|
||||
- net_log $"'network-scripts' will be removed from distribution in near future." warning ifdown >&2
|
||||
- net_log $"It is advised to switch to 'NetworkManager' instead - it provides 'ifup/ifdown' scripts as well." warning ifdown >&2
|
||||
-fi
|
||||
-
|
||||
need_config "${CONFIG}"
|
||||
|
||||
[ -f "$CONFIG" ] || {
|
||||
@@ -42,6 +36,12 @@ fi
|
||||
|
||||
source_config
|
||||
|
||||
+if ! is_true ${DEPRECATION_WARNING_ISSUED}; then
|
||||
+ net_log $"You are using 'ifdown' script provided by 'network-scripts', which are now deprecated." warning ifdown >&2
|
||||
+ net_log $"'network-scripts' will be removed from distribution in near future." warning ifdown >&2
|
||||
+ net_log $"It is advised to switch to 'NetworkManager' instead - it provides 'ifup/ifdown' scripts as well." warning ifdown >&2
|
||||
+fi
|
||||
+
|
||||
if [ -n "$IN_HOTPLUG" ] && [ "${HOTPLUG}" = "no" -o "${HOTPLUG}" = "NO" ]
|
||||
then
|
||||
exit 0
|
||||
diff --git a/network-scripts/ifup b/network-scripts/ifup
|
||||
index 435c317..397dd93 100755
|
||||
--- a/network-scripts/ifup
|
||||
+++ b/network-scripts/ifup
|
||||
@@ -31,12 +31,6 @@ CONFIG=${1}
|
||||
exit 1
|
||||
}
|
||||
|
||||
-if ! is_true ${DEPRECATION_WARNING_ISSUED}; then
|
||||
- net_log $"You are using 'ifup' script provided by 'network-scripts', which are now deprecated." warning ifup >&2
|
||||
- net_log $"'network-scripts' will be removed from distribution in near future." warning ifup >&2
|
||||
- net_log $"It is advised to switch to 'NetworkManager' instead - it provides 'ifup/ifdown' scripts as well." warning ifup >&2
|
||||
-fi
|
||||
-
|
||||
need_config "${CONFIG}"
|
||||
|
||||
[ -f "${CONFIG}" ] || {
|
||||
@@ -58,6 +52,12 @@ fi
|
||||
|
||||
source_config
|
||||
|
||||
+if ! is_true ${DEPRECATION_WARNING_ISSUED}; then
|
||||
+ net_log $"You are using 'ifup' script provided by 'network-scripts', which are now deprecated." warning ifup >&2
|
||||
+ net_log $"'network-scripts' will be removed from distribution in near future." warning ifup >&2
|
||||
+ net_log $"It is advised to switch to 'NetworkManager' instead - it provides 'ifup/ifdown' scripts as well." warning ifup >&2
|
||||
+fi
|
||||
+
|
||||
if [ "foo$2" = "fooboot" ] && [ "${ONBOOT}" = "no" -o "${ONBOOT}" = "NO" ]
|
||||
then
|
||||
exit 0
|
||||
--
|
||||
2.6.1.windows.1
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
From bf6a9d7d1f708077bfaad8ea109ad8b4eeb69556 Mon Sep 17 00:00:00 2001
|
||||
From: "David Kaspar [Dee'Kej]" <dkaspar@redhat.com>
|
||||
Date: Mon, 20 Aug 2018 14:31:56 +0200
|
||||
Subject: [PATCH 3/4] ifup-post: fix incorrect condition for RESOLV_MODS
|
||||
|
||||
This was causing the /etc/resolv.conf file to be always updated when
|
||||
RESOLV_MODS was not set...
|
||||
|
||||
Before the commit 5d6156454bf8f6dab4a5fdd7e1bf6 we were not updating
|
||||
the /etc/resolv.conf file if the RESOLV_MODS was empty.
|
||||
|
||||
See https://bugzilla.redhat.com/show_bug.cgi?id=1610411 for more info.
|
||||
---
|
||||
network-scripts/ifup-post | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/network-scripts/ifup-post b/network-scripts/ifup-post
|
||||
index 5a89cbf3..4cb986f8 100755
|
||||
--- a/network-scripts/ifup-post
|
||||
+++ b/network-scripts/ifup-post
|
||||
@@ -28,7 +28,7 @@ if ! is_true "$NOROUTESET"; then
|
||||
fi
|
||||
|
||||
|
||||
-if ! is_false "${PEERDNS}" || ! is_false "${RESOLV_MODS}"; then
|
||||
+if ! is_false "${PEERDNS}" || is_true "${RESOLV_MODS}"; then
|
||||
# Obtain the DNS entries when using PPP if necessary:
|
||||
[ -n "${MS_DNS1}" ] && DNS1="${MS_DNS1}"
|
||||
[ -n "${MS_DNS2}" ] && DNS2="${MS_DNS2}"
|
||||
--
|
||||
2.19.1
|
||||
|
||||
Binary file not shown.
BIN
initscripts-10.04.tar.gz
Normal file
BIN
initscripts-10.04.tar.gz
Normal file
Binary file not shown.
@ -19,8 +19,8 @@ Requires: gawk \
|
||||
|
||||
Name: initscripts
|
||||
Summary: Basic support for legacy System V init scripts
|
||||
Version: 10.01
|
||||
Release: 5
|
||||
Version: 10.04
|
||||
Release: 4
|
||||
|
||||
License: GPLv2
|
||||
|
||||
@ -74,27 +74,23 @@ Obsoletes: %{name} < 9.82-2
|
||||
|
||||
# Downstream patches for RHEL -- patches that we keep only in RHEL for various
|
||||
# --------------------------- reasons, but are not enabled in Fedora:
|
||||
%if %{defined rhel} || %{defined centos}
|
||||
%if %{defined rhel} || %{defined centos} || %{defined openEuler}
|
||||
#Patch200: example200.patch
|
||||
%endif
|
||||
|
||||
|
||||
# Patches to be removed -- deprecated functionality which shall be removed at
|
||||
# --------------------- some point in the future:
|
||||
Patch6000: ifup-ifdown-print-DEPRECATION_WARNING_ISSUED-waring.patch
|
||||
Patch6001: ifup-post-fix-incorrect-condition-for-RESOLV_MODS.patch
|
||||
Patch6002: run-ifdown-on-all-interfaces.patch
|
||||
|
||||
|
||||
Patch9000: bugfix-maintain-permissions-set-umask-in-case-resolvconf-doesnt-exist.patch
|
||||
Patch9001: bugfix-initscripts-add-udev-wait-dependency-for-network.patch
|
||||
Patch9002: bugfix-mod-network-function-when-NM-unmanage-devices.patch
|
||||
Patch9003: bugfix-initscripts-set-PERSISTENT_DHCLIENT-default-to-yes.patch
|
||||
Patch9004: bugfix-network-need-chkconfig-on.patch
|
||||
Patch9005: bugfix-restart-network-warning.patch
|
||||
Patch9006: new-network-fork-to-start-dhcp.patch
|
||||
Patch9007: exec-udevadm-settle-when-network-start.patch
|
||||
Patch9008: bugfix-network-check-val-of-the-grep.patch
|
||||
Patch0: run-ifdown-on-all-interfaces.patch
|
||||
Patch1: bugfix-initscripts-add-udev-wait-dependency-for-network.patch
|
||||
Patch2: bugfix-mod-network-function-when-NM-unmanage-devices.patch
|
||||
Patch3: bugfix-initscripts-set-PERSISTENT_DHCLIENT-default-to-yes.patch
|
||||
Patch4: bugfix-network-need-chkconfig-on.patch
|
||||
Patch5: bugfix-restart-network-warning.patch
|
||||
Patch6: new-network-fork-to-start-dhcp.patch
|
||||
Patch7: exec-udevadm-settle-when-network-start.patch
|
||||
Patch8: remove-rename_device_lock-when-process-does-not-exist.patch
|
||||
Patch9: backport-ifup-eth-add-a-new-PERSISTENT_DHCLIENT_IPV6-option-f.patch
|
||||
|
||||
%description
|
||||
This package provides basic support for legacy System V init scripts, and some
|
||||
@ -290,12 +286,11 @@ fi
|
||||
|
||||
# ---------------
|
||||
|
||||
%ghost %config(noreplace, missingok) %verify(not md5 size mtime) %{_sysconfdir}/rc.d/rc.local
|
||||
|
||||
%{_sysconfdir}/rc.d/init.d/functions
|
||||
|
||||
# RC symlinks:
|
||||
%{_sysconfdir}/rc[0-6].d
|
||||
%{_sysconfdir}/init.d
|
||||
|
||||
# ---------------
|
||||
|
||||
@ -361,6 +356,36 @@ fi
|
||||
# =============================================================================
|
||||
|
||||
%changelog
|
||||
* Thu Jun 30 2022 xingwei <xingwei14@h-partners.com> - 10.04-4
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:Initscripts no looger care about rc.local
|
||||
|
||||
* Wed Jan 26 2022 gaoxingwang<gaoxingwang@huawei.com> - 10.04-3
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: ifup-eth: add a new PERSISTENT_DHCLIENT_IPV6 option for IPv6 dhclient daemon
|
||||
|
||||
* Tue Dec 29 2020 zengwefeng<zwfeng@huawei.com> - 10.04-2
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:remove .rename_device.lock when process does not exist
|
||||
|
||||
* Wed Aug 19 2020 gaihuiying<gaihuiying11@huawei.com> - 10.04-1
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:update to 10.04
|
||||
|
||||
* Thu Mar 5 2020 openEuler Buildteam <buildteam@openeuler.org> - 10.01-6
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:adapt to the grep command line
|
||||
|
||||
* Tue Mar 3 2020 openEuler Buildteam <buildteam@openeuler.org> - 10.01-5
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
@ -11,7 +11,7 @@ Signed-off-by: rpm-build <rpm-build>
|
||||
1 file changed, 31 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/etc/rc.d/init.d/network b/etc/rc.d/init.d/network
|
||||
index 97e6ed1..5f95ee0 100755
|
||||
index 31bbe20..994425d 100755
|
||||
--- a/etc/rc.d/init.d/network
|
||||
+++ b/etc/rc.d/init.d/network
|
||||
@@ -49,6 +49,8 @@ interfaces=$(ls ifcfg-* | \
|
||||
@ -19,40 +19,38 @@ index 97e6ed1..5f95ee0 100755
|
||||
rc=0
|
||||
|
||||
+godamon=0
|
||||
+
|
||||
+
|
||||
net_log $"You are using 'network' service provided by 'network-scripts', which are now deprecated." warning network >&2
|
||||
net_log $"'network-scripts' will be removed from distribution in near future." warning network >&2
|
||||
net_log $"It is advised to switch to 'NetworkManager' instead for network management." warning network >&2
|
||||
@@ -131,17 +133,41 @@ start)
|
||||
@@ -129,18 +131,39 @@ start)
|
||||
is_available $i
|
||||
continue
|
||||
fi
|
||||
- action $"Bringing up interface $i: " ./ifup $i boot
|
||||
- [ $? -ne 0 ] && rc=1
|
||||
+ if [ "$godamon" != "1" ] ; then
|
||||
+ action $"Bringing up interface $i: " ./ifup $i boot
|
||||
+ [ $? -ne 0 ] && rc=1
|
||||
+ else
|
||||
+ action $"Bringing up interface $i: " ./ifup $i boot &
|
||||
+ fi
|
||||
+
|
||||
+
|
||||
+ if [ "$godamon" != "1" ] ; then
|
||||
+ action $"Bringing up interface $i: " ./ifup $i boot
|
||||
+ [ $? -ne 0 ] && rc=1
|
||||
+ else
|
||||
+ action $"Bringing up interface $i: " ./ifup $i boot &
|
||||
+ fi
|
||||
done
|
||||
|
||||
# Bring up xDSL and VPN interfaces
|
||||
for i in $vlaninterfaces $bridgeinterfaces $xdslinterfaces $vpninterfaces ; do
|
||||
if ! LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i >/dev/null 2>&1 ; then
|
||||
if ( . ./ifcfg-"$i" ; ! is_false "$ONBOOT" ) ; then
|
||||
- action $"Bringing up interface $i: " ./ifup $i boot
|
||||
- [ $? -ne 0 ] && rc=1
|
||||
- fi
|
||||
+ if [ "$godamon" != "1" ] ; then
|
||||
+ action $"Bringing up interface $i: " ./ifup $i boot
|
||||
+ [ $? -ne 0 ] && rc=1
|
||||
+ else
|
||||
+ action $"Bringing up interface $i: " ./ifup $i boot &
|
||||
+ fi
|
||||
+ fi
|
||||
+ if [ "$godamon" != "1" ] ; then
|
||||
+ action $"Bringing up interface $i: " ./ifup $i boot
|
||||
+ [ $? -ne 0 ] && rc=1
|
||||
+ else
|
||||
+ action $"Bringing up interface $i: " ./ifup $i boot &
|
||||
+ fi
|
||||
fi
|
||||
done
|
||||
-
|
||||
+ # Waiting until all background process done
|
||||
+ if [ "$godamon" = "1" ] ; then
|
||||
+ for pid in $(jobs -p)
|
||||
@ -67,9 +65,8 @@ index 97e6ed1..5f95ee0 100755
|
||||
+ rc=0
|
||||
+ done
|
||||
+ fi
|
||||
|
||||
# Add non interface-specific static-routes.
|
||||
if [ -f /etc/sysconfig/static-routes ]; then
|
||||
if [ -x /sbin/route ]; then
|
||||
--
|
||||
2.19.1
|
||||
|
||||
|
||||
45
remove-rename_device_lock-when-process-does-not-exist.patch
Normal file
45
remove-rename_device_lock-when-process-does-not-exist.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From 882677f72fd4541a9e1aa4b8c40d8095f1be3536 Mon Sep 17 00:00:00 2001
|
||||
From: rpm-build <rpm-build>
|
||||
Date: Mon, 14 Dec 2020 20:52:47 +0800
|
||||
Subject: [PATCH] remove-rename_device_lock-when-process-does-not-exist.patch
|
||||
|
||||
---
|
||||
src/rename_device.c | 15 +++++++++++++--
|
||||
1 file changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/rename_device.c b/src/rename_device.c
|
||||
index c39f447..5e49bbd 100644
|
||||
--- a/src/rename_device.c
|
||||
+++ b/src/rename_device.c
|
||||
@@ -278,6 +278,13 @@ char *get_config_by_hwaddr(char *hwaddr, char *current) {
|
||||
return first;
|
||||
}
|
||||
|
||||
+int pid_exist(int pid)
|
||||
+{
|
||||
+ char proc_dir[32];
|
||||
+ sprintf(proc_dir, "/proc/%d/", pid);
|
||||
+ return !access(proc_dir, F_OK);
|
||||
+}
|
||||
+
|
||||
void take_lock() {
|
||||
int count = 0;
|
||||
int lockfd;
|
||||
@@ -309,8 +316,12 @@ void take_lock() {
|
||||
close(fd);
|
||||
pid = atoi(buf);
|
||||
if (pid && pid != 1) {
|
||||
- kill(pid,SIGKILL);
|
||||
- }
|
||||
+ if (pid_exist(pid))
|
||||
+ kill(pid,SIGKILL);
|
||||
+ else
|
||||
+ if (unlink(LOCKFILE) != 0)
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
usleep(100000);
|
||||
continue;
|
||||
--
|
||||
2.23.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user