1
0
Fork 0
mirror of https://github.com/pygos/init.git synced 2024-11-22 03:09:46 +01:00

Store original file name in service structure

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-04-21 22:19:43 +02:00
parent 32113521eb
commit 160cd6b6aa
3 changed files with 7 additions and 0 deletions

View file

@ -53,6 +53,8 @@ typedef struct exec_t {
typedef struct service_t { typedef struct service_t {
struct service_t *next; struct service_t *next;
char *fname; /* source file name */
int type; /* SVC_* service type */ int type; /* SVC_* service type */
int target; /* TGT_* service target */ int target; /* TGT_* service target */
char *desc; /* description string */ char *desc; /* description string */

View file

@ -35,6 +35,7 @@ void delsvc(service_t *svc)
free(svc->before); free(svc->before);
free(svc->after); free(svc->after);
free(svc->fname);
free(svc->desc); free(svc->desc);
free(svc->exec); free(svc->exec);
free(svc->ctty); free(svc->ctty);

View file

@ -289,6 +289,10 @@ service_t *rdsvc(int dirfd, const char *filename)
if (svc == NULL) if (svc == NULL)
goto fail_oom; goto fail_oom;
svc->fname = strdup(filename);
if (svc->fname == NULL)
goto fail_oom;
memcpy(svc->name, filename, nlen); memcpy(svc->name, filename, nlen);
while ((ret = rdline(&rd)) == 0) { while ((ret = rdline(&rd)) == 0) {