6 pidfile_t *read_pidfile(void) {
7 FILE *f = fopen(pidfilename, "r");
13 pidfile_t *pf = malloc(sizeof(pidfile_t));
14 int read = fscanf(f, "%20d %64s %128s port %128s", &pf->pid, pf->cookie, pf->host, pf->port);
26 bool write_pidfile(const char *controlcookie, const char *address) {
27 const mode_t mask = umask(0);
29 FILE *f = fopen(pidfilename, "w");
36 fprintf(f, "%d %s %s\n", (int)getpid(), controlcookie, address);