From 68363b527cede87bfc189171397dbbd473efba24 Mon Sep 17 00:00:00 2001 From: Jan Macku Date: Thu, 21 Jan 2021 08:40:15 +0100 Subject: Revert "remove rename_device_lock when process does not exist" This reverts commit dbff71b664c7536d09dc3172259d8984005b60fa. --- src/rename_device.c | 14 +------------- 1 file changed, 1 insertion(+), 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); -- cgit v1.2.1