diff options
author | Jan Macku <jamacku@redhat.com> | 2021-01-21 08:40:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-21 08:40:15 +0100 |
commit | 68363b527cede87bfc189171397dbbd473efba24 (patch) | |
tree | ec410e4ad98daef7e17fc28d70ed26f183b832e2 /src/rename_device.c | |
parent | c53256fbb1df709421f0fe11d97353a47d7704c4 (diff) | |
download | initscripts-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"
This reverts commit dbff71b664c7536d09dc3172259d8984005b60fa.
Diffstat (limited to 'src/rename_device.c')
-rw-r--r-- | src/rename_device.c | 14 |
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); |