Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:Update
cronie.6903
cronie-1.4.11-pidfile_locking.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File cronie-1.4.11-pidfile_locking.patch of Package cronie.6903
From 49225e172d156531ca142518d2638350752e373a Mon Sep 17 00:00:00 2001 From: Tomas Mraz <tmraz@fedoraproject.org> Date: Fri, 9 Aug 2013 14:57:57 +0200 Subject: Fcntl locking has different semantics than flock. Prefer flock. --- src/misc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/misc.c b/src/misc.c index 106f10e..40fc58c 100644 --- a/src/misc.c +++ b/src/misc.c @@ -75,7 +75,9 @@ static int LogFD = ERR; static int syslog_open = FALSE; #endif -#if defined(HAVE_FCNTL) && defined(F_SETLK) +#if defined(HAVE_FLOCK) +# define trylock_file(fd) flock((fd), LOCK_EX|LOCK_NB) +#elif defined(HAVE_FCNTL) && defined(F_SETLK) static int trylock_file(int fd) { struct flock fl; @@ -89,8 +91,6 @@ static int trylock_file(int fd) { } #elif defined(HAVE_LOCKF) # define trylock_file(fd) lockf((fd), F_TLOCK, 0) -#elif defined(HAVE_FLOCK) -# define trylock_file(fd) flock((fd), LOCK_EX|LOCK_NB) #endif /* @@ -345,6 +345,13 @@ void acquire_daemonlock(int closeflag) { (void) fchmod(fd, 0644); (void) fcntl(fd, F_SETFD, 1); } +#if !defined(HAVE_FLOCK) + else { + /* Racy but better than nothing, just hope the parent exits */ + sleep(0); + trylock_file(fd); + } +#endif sprintf(buf, "%ld\n", (long) pid); (void) lseek(fd, (off_t) 0, SEEK_SET); -- cgit v0.12
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor