libmpm

morphux C package management library
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/libmpm

commit 3b23c38718bae2726922bf5cd85dfd2e2b4a2807
parent 0e08247178ff47cb7479c8e0bc20e58ce9c7f391
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Tue, 18 Apr 2017 23:35:17 +0200

Fix(Conflicts): Fix merge conflicts in inc/packer.h

Diffstat:
Minc/packer.h | 1+
Msrc/packer.c | 11++++++++---
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/inc/packer.h b/inc/packer.h @@ -24,6 +24,7 @@ # include <arpa/inet.h> # include <sys/types.h> # include <dirent.h> +# include <limits.h> # define PACKER_DEF_CONF_FN "package.json" # define PACKER_DEF_EXT ".mpx" diff --git a/src/packer.c b/src/packer.c @@ -403,14 +403,19 @@ cleanup: } bool packer_read_dir(packer_t *ctx) { - char *old_pwd = getenv("PWD"); + char old_pwd[PATH_MAX]; assert(ctx != NULL); + getcwd(old_pwd, sizeof(old_pwd)); + + /* If we can't get the current working directory, it's a fatal error */ + assert(old_pwd != NULL); + if (ctx->type != PACKER_TYPE_DIRECTORY) - return false; + goto error; if (chdir(ctx->str) == -1) - return false; + goto error; ctx->json = json_object_from_file(PACKER_DEF_CONF_FN); if (ctx->json == NULL)