Commit 865d9b90 authored by Niels Möller's avatar Niels Möller
Browse files

Minor fixes.

Rev: src/blocking_write.c:1.15
Rev: src/daemon.c:1.3
parent 6be28df2
......@@ -34,7 +34,7 @@
(fd . int)
(e object exception_handler)
(write . (pointer (function void
int UINT32 "UINT8 *" "struct exception_handler *e")))))
int UINT32 "const UINT8 *" "struct exception_handler *e")))))
*/
#include "blocking_write.c.x"
......
......@@ -29,6 +29,7 @@
#include "format.h"
#include "werror.h"
#include "xalloc.h"
#include <stdlib.h>
#include <stdio.h>
......@@ -199,15 +200,17 @@ int daemon_pidfile(const char *name)
}
else
{
struct lsh_string *pid = ssh_format("%ldi", getpid());
struct lsh_string *pid = ssh_format("%di", getpid());
int res = write(fd, pid->data, pid->length);
close(fd);
if ( (res > 0) && ((unsigned) res == pid->length) )
/* Success! */
return 1;
{
/* Success! */
lsh_string_free(pid);
return 1;
}
werror("Writing pid file '%z' failed (errno = %i): %z",
name, errno, STRERROR(errno));
......@@ -215,10 +218,13 @@ int daemon_pidfile(const char *name)
if (unlink(name) < 0)
werror("Unlinking pid file '%z' failed (errno = %i): %z",
name, errno, STRERROR(errno));
lsh_string_free(pid);
return 0;
}
}
/*
** int daemon_started_by_init(void)
**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment