aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Macku <jamacku@redhat.com>2021-01-21 08:40:15 +0100
committerGitHub <noreply@github.com>2021-01-21 08:40:15 +0100
commit68363b527cede87bfc189171397dbbd473efba24 (patch)
treeec410e4ad98daef7e17fc28d70ed26f183b832e2
parentc53256fbb1df709421f0fe11d97353a47d7704c4 (diff)
downloadinitscripts-68363b527cede87bfc189171397dbbd473efba24.tar
initscripts-68363b527cede87bfc189171397dbbd473efba24.tar.gz
initscripts-68363b527cede87bfc189171397dbbd473efba24.tar.bz2
initscripts-68363b527cede87bfc189171397dbbd473efba24.tar.xz
initscripts-68363b527cede87bfc189171397dbbd473efba24.zip
Revert "remove rename_device_lock when process does not exist"
-rw-r--r--src/rename_device.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/rename_device.c b/src/rename_device.c
index b4ed69eb..c39f447d 100644
--- a/src/rename_device.c
+++ b/src/rename_device.c
@@ -278,14 +278,6 @@ 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;
@@ -317,11 +309,7 @@ void take_lock() {
close(fd);
pid = atoi(buf);
if (pid && pid != 1) {
- if (pid_exist(pid))
- kill(pid,SIGKILL);
- else
- if (unlink(LOCKFILE) != 0)
- break;
+ kill(pid,SIGKILL);
}
}
usleep(100000);