summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-11-04 15:02:11 +0100
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-11-04 15:02:11 +0100
commitc0e8c7e245c09598478302155b37a15f3370571f (patch)
treec2e4d7d62f00c8de12d08d9d469b8c31b3f1e21d /cmd
parent074fe20a4761e284af2aa46f978f48410cfa60c5 (diff)
cleanup: let rdline_init open the file
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Makemodule.am4
-rw-r--r--cmd/runsvc/env.c9
2 files changed, 4 insertions, 9 deletions
diff --git a/cmd/Makemodule.am b/cmd/Makemodule.am
index f2c7d5f..78692d1 100644
--- a/cmd/Makemodule.am
+++ b/cmd/Makemodule.am
@@ -8,7 +8,7 @@ runsvc_SOURCES = cmd/runsvc/runsvc.c cmd/runsvc/env.c cmd/runsvc/runsvc.h
runsvc_CPPFLAGS = $(AM_CPPFLAGS)
runsvc_CFLAGS = $(AM_CFLAGS)
runsvc_LDFLAGS = $(AM_LDFLAGS)
-runsvc_LDADD = libinit.a libutil.a libcfg.a
+runsvc_LDADD = libinit.a libcfg.a libutil.a
killall5_SOURCES = cmd/killall5.c
killall5_CPPFLAGS = $(AM_CPPFLAGS)
@@ -24,7 +24,7 @@ service_SOURCES += $(SRVHEADERS)
service_CPPFLAGS = $(AM_CPPFLAGS)
service_CFLAGS = $(AM_CFLAGS)
service_LDFLAGS = $(AM_LDFLAGS)
-service_LDADD = libinit.a libutil.a libcfg.a
+service_LDADD = libinit.a libcfg.a libutil.a
if GCROND
service_SOURCES += cmd/service/schedule.c
diff --git a/cmd/runsvc/env.c b/cmd/runsvc/env.c
index 1e73ee4..e58d803 100644
--- a/cmd/runsvc/env.c
+++ b/cmd/runsvc/env.c
@@ -86,17 +86,12 @@ static struct entry *list_from_file(void)
{
struct entry *list;
rdline_t rd;
- int fd;
- fd = open(ENVFILE, O_RDONLY);
- if (fd < 0) {
- perror(ENVFILE);
+ if (rdline_init(&rd, AT_FDCWD, ENVFILE, 0, NULL))
return NULL;
- }
- rdline_init(&rd, fd, ENVFILE, 0, NULL);
list = parse_list(&rd);
- close(fd);
+ rdline_cleanup(&rd);
return list;
}