- Fix linux build
This commit is contained in:
parent
a85a6ce909
commit
98d0f8f89e
@ -9,6 +9,12 @@ struct pidfh {
|
|||||||
|
|
||||||
static int _pidfile_remove(struct pidfh *pfh, int freeit);
|
static int _pidfile_remove(struct pidfh *pfh, int freeit);
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#define PROGNAME program_invocation_short_name
|
||||||
|
#else
|
||||||
|
#define PROGNAME getprogname()
|
||||||
|
#endif /* __linux__ */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pidfile_verify(const struct pidfh *pfh)
|
pidfile_verify(const struct pidfh *pfh)
|
||||||
{
|
{
|
||||||
@ -133,7 +139,7 @@ pidfile_open(const char *path, mode_t mode, pid_t *pidptr)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
len = snprintf(pfh->pf_path, sizeof(pfh->pf_path), "/var/run/%s.pid", getprogname());
|
len = snprintf(pfh->pf_path, sizeof(pfh->pf_path), "/var/run/%s.pid", PROGNAME);
|
||||||
else
|
else
|
||||||
len = snprintf(pfh->pf_path, sizeof(pfh->pf_path), "%s", path);
|
len = snprintf(pfh->pf_path, sizeof(pfh->pf_path), "%s", path);
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
#ifndef _PIDUTIL_H
|
#ifndef _PIDUTIL_H
|
||||||
#define _PIDUTIL_H
|
#define _PIDUTIL_H
|
||||||
|
|
||||||
|
#ifndef _GNU_SOURCE
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -16,6 +20,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
struct pidfh;
|
struct pidfh;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user