mirror of
https://github.com/pygos/init.git
synced 2024-11-05 20:27:09 +01:00
24 lines
403 B
C
24 lines
403 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, int flags)
|
||
|
{
|
||
|
service_t *svc;
|
||
|
int dirfd;
|
||
|
|
||
|
dirfd = open(directory, O_RDONLY | O_DIRECTORY);
|
||
|
|
||
|
if (dirfd < 0) {
|
||
|
perror(directory);
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
svc = rdsvc(dirfd, filename, flags);
|
||
|
close(dirfd);
|
||
|
return svc;
|
||
|
}
|