diff options
author | Edan Bedrik <3d4nb3@gmail.com> | 2018-05-08 11:30:01 +0300 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2019-02-12 17:56:17 -0600 |
commit | b2b2c57a3898c945b33b8bf0a10b658483be09c1 (patch) | |
tree | 4376fbe97adf49bbcc7caca709e03eb5222935e0 | |
parent | 155b8451945f8a17cd61ad56be3bb09541c3719a (diff) |
librc: fix realpath() return value check
This fixes #226.
-rw-r--r-- | src/librc/librc.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c index 1bdd9307..9d6abc7a 100644 --- a/src/librc/librc.c +++ b/src/librc/librc.c @@ -1047,7 +1047,6 @@ rc_service_add(const char *runlevel, const char *service) char *init; char file[PATH_MAX]; char path[MAXPATHLEN] = { '\0' }; - char *p = NULL; char binit[PATH_MAX]; char *i; @@ -1068,8 +1067,7 @@ rc_service_add(const char *runlevel, const char *service) /* We need to ensure that only things in /etc/init.d are added * to the boot runlevel */ if (strcmp(runlevel, RC_LEVEL_BOOT) == 0) { - p = realpath(dirname(init), path); - if (!*p) { + if (realpath(dirname(init), path) == NULL) { free(init); return false; } |