From 160cd6b6aaffc12fb8cff0e6a9b8e1e0ba7053d0 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sat, 21 Apr 2018 22:19:43 +0200 Subject: Store original file name in service structure Signed-off-by: David Oberhollenzer --- lib/include/service.h | 2 ++ lib/src/delsvc.c | 1 + lib/src/rdsvc.c | 4 ++++ 3 files changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/include/service.h b/lib/include/service.h index 595c60e..c68ff90 100644 --- a/lib/include/service.h +++ b/lib/include/service.h @@ -53,6 +53,8 @@ typedef struct exec_t { typedef struct service_t { struct service_t *next; + char *fname; /* source file name */ + int type; /* SVC_* service type */ int target; /* TGT_* service target */ char *desc; /* description string */ diff --git a/lib/src/delsvc.c b/lib/src/delsvc.c index fd10cfe..9ab51f1 100644 --- a/lib/src/delsvc.c +++ b/lib/src/delsvc.c @@ -35,6 +35,7 @@ void delsvc(service_t *svc) free(svc->before); free(svc->after); + free(svc->fname); free(svc->desc); free(svc->exec); free(svc->ctty); diff --git a/lib/src/rdsvc.c b/lib/src/rdsvc.c index 1f859b7..ef3465f 100644 --- a/lib/src/rdsvc.c +++ b/lib/src/rdsvc.c @@ -289,6 +289,10 @@ service_t *rdsvc(int dirfd, const char *filename) if (svc == NULL) goto fail_oom; + svc->fname = strdup(filename); + if (svc->fname == NULL) + goto fail_oom; + memcpy(svc->name, filename, nlen); while ((ret = rdline(&rd)) == 0) { -- cgit v1.2.3