bmsd/lock.c

changeset 745
3addb8cfcc3e
parent 704
62a1d2baec75
child 746
44d929ff268e
equal deleted inserted replaced
744:b8ccc85675a0 745:3addb8cfcc3e
1 /***************************************************************************** 1 /*****************************************************************************
2 * Copyright (C) 2017-2020 2 * Copyright (C) 2017-2021
3 * 3 *
4 * Michiel Broek <mbroek at mbse dot eu> 4 * Michiel Broek <mbroek at mbse dot eu>
5 * 5 *
6 * This file is part of the bms (Brewery Management System) 6 * This file is part of the bms (Brewery Management System)
7 * 7 *
82 return 1; 82 return 1;
83 } 83 }
84 fclose(fp); 84 fclose(fp);
85 if (kill(oldpid,0) == -1) { 85 if (kill(oldpid,0) == -1) {
86 if (errno == ESRCH || errno == EPERM) { 86 if (errno == ESRCH || errno == EPERM) {
87 syslog(LOG_NOTICE, "Stale lock found for pid %u", oldpid); 87 syslog(LOG_NOTICE, "Stale lock found for pid %u, try lock again", oldpid);
88 unlink(lockfile); 88 unlink(lockfile);
89 /* no return, try lock again */ 89 /* no return, try lock again */
90 } else { 90 } else {
91 syslog(LOG_NOTICE, "Kill for %u failed: %s",oldpid, strerror(errno)); 91 syslog(LOG_NOTICE, "Kill for %u failed: %s",oldpid, strerror(errno));
92 unlink(tempfile); 92 unlink(tempfile);

mercurial