diff options
Diffstat (limited to 'cmd/service/loadsvc.c')
-rw-r--r-- | cmd/service/loadsvc.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cmd/service/loadsvc.c b/cmd/service/loadsvc.c new file mode 100644 index 0000000..bbd15f8 --- /dev/null +++ b/cmd/service/loadsvc.c @@ -0,0 +1,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, 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; +} |