pm

barely a pack manager
git clone git://z3bra.org/pm
Log | Files | Refs | README | LICENSE

commit 166af82b0e517d8d199c9d63ef09739729b3c007
parent 1faefbbfe0b101f39b95ce9140ced9b692889273
Author: z3bra <willyatmailoodotorg>
Date:   Tue Jan 26 09:52:17 +0100

Fix segfault when $ROOT is empty

Diffstat:
pm.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pm.c b/pm.c @@ -13,6 +13,7 @@ #include "arg.h" +#define PACK_ROOT (getenv("ROOT")?getenv("ROOT"):"") #define PACK_DATA "var/pm" #define PACK_BUFF_SIZE 8192 #define PACK_SEPARATOR '#' @@ -619,7 +620,7 @@ main (int argc, char **argv) char rootfs[PATH_MAX] = ""; char datadir[PATH_MAX] = ""; - strncpy(rootfs, getenv("ROOT"), PATH_MAX); + strncpy(rootfs, PACK_ROOT, PATH_MAX); strncat(rootfs, "/", PATH_MAX); strncpy(datadir, rootfs, PATH_MAX); strncat(datadir, PACK_DATA, PATH_MAX);