/* Copyright (c) 2008-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "lib-signals.h"
#include "ioloop.h"
#include "write-full.h"
#include "file-dotlock.h"
#include "index/maildir/maildir-uidlist.h"
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
};
{
}
{
}
{
unsigned int timeout;
char c;
if (argc != 3) {
" - SIGTERM will release the lock.\n");
return 1;
}
return 1;
}
return 1;
}
/* call lib_init() only after fork so that PID gets set correctly */
lib_init();
ioloop = io_loop_create();
if (pid != 0) {
if (ret < 0) {
i_error("read(pipe) failed: %m");
return 1;
}
if (ret != 1) {
/* locking timed out */
return 1;
}
return 0;
}
/* child process - stdout has to be closed so that caller knows when
to stop reading it. */
i_fatal("dup2() failed: %m");
return 1;
/* locked - send a byte */
i_fatal("write(pipe) failed: %m");
lib_deinit();
return 0;
}