blob: 8c6915bdca747cde9582f6096c3a445dd667fe2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/* 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;
}
|