Bump liberty

This commit is contained in:
Přemysl Eric Janouch 2016-01-17 04:43:43 +01:00
parent f070523085
commit 6db40c4503
2 changed files with 2 additions and 47 deletions

47
kike.c
View File

@ -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;
}

@ -1 +1 @@
Subproject commit 8a9a28231bba6334c383dca59f7eccd1e5075693
Subproject commit f213a76ad494efe150a786b195a744e4b87c5ca9