From 6db40c450399f215b1abdb42d5d1d6dee58debb4 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sun, 17 Jan 2016 04:43:43 +0100 Subject: Bump liberty --- kike.c | 47 +---------------------------------------------- liberty | 2 +- 2 files changed, 2 insertions(+), 47 deletions(-) diff --git a/kike.c b/kike.c index d574ef4..1e65318 100644 --- a/kike.c +++ b/kike.c @@ -3783,51 +3783,6 @@ irc_initialize_server_name (struct server_context *ctx, struct error **e) return true; } -static bool -lock_pid_file (const char *path, struct error **e) -{ - // When using XDG_RUNTIME_DIR, the file needs to either have its - // access time bumped every 6 hours, or have the sticky bit set - int fd = open (path, O_RDWR | O_CREAT, - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH /* 644 */ | S_ISVTX /* sticky */); - if (fd < 0) - { - error_set (e, "can't open `%s': %s", path, strerror (errno)); - return false; - } - - struct flock lock = - { - .l_type = F_WRLCK, - .l_start = 0, - .l_whence = SEEK_SET, - .l_len = 0, - }; - if (fcntl (fd, F_SETLK, &lock)) - { - error_set (e, "can't lock `%s': %s", path, strerror (errno)); - xclose (fd); - return false; - } - - struct str pid; - str_init (&pid); - str_append_printf (&pid, "%ld", (long) getpid ()); - - if (ftruncate (fd, 0) - || write (fd, pid.str, pid.len) != (ssize_t) pid.len) - { - error_set (e, "can't write to `%s': %s", path, strerror (errno)); - xclose (fd); - return false; - } - str_free (&pid); - - // Intentionally not closing the file descriptor; it must stay alive - // for the entire life of the application - return true; -} - static bool irc_lock_pid_file (struct server_context *ctx, struct error **e) { @@ -3836,7 +3791,7 @@ irc_lock_pid_file (struct server_context *ctx, struct error **e) return true; char *resolved = resolve_filename (path, resolve_relative_runtime_filename); - bool result = lock_pid_file (resolved, e); + bool result = lock_pid_file (resolved, e) != -1; free (resolved); return result; } diff --git a/liberty b/liberty index 8a9a282..f213a76 160000 --- a/liberty +++ b/liberty @@ -1 +1 @@ -Subproject commit 8a9a28231bba6334c383dca59f7eccd1e5075693 +Subproject commit f213a76ad494efe150a786b195a744e4b87c5ca9 -- cgit v1.2.3-70-g09d2