mirror of
https://github.com/pygos/init.git
synced 2024-11-22 03:09:46 +01:00
David Oberhollenzer
70ea16b0b4
With the previous changes, there were only used by the status command. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
23 lines
385 B
C
23 lines
385 B
C
/* SPDX-License-Identifier: ISC */
|
|
#include "servicecmd.h"
|
|
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include <stdio.h>
|
|
|
|
service_t *loadsvc(const char *directory, const char *filename)
|
|
{
|
|
service_t *svc;
|
|
int dirfd;
|
|
|
|
dirfd = open(directory, O_RDONLY | O_DIRECTORY);
|
|
|
|
if (dirfd < 0) {
|
|
perror(directory);
|
|
return NULL;
|
|
}
|
|
|
|
svc = rdsvc(dirfd, filename);
|
|
close(dirfd);
|
|
return svc;
|
|
}
|