From 7e551bb166cb5e24d52a32938335cd18f9efb217 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 5 Sep 2016 20:51:38 -0700 Subject: [PATCH 1/1] With -p on all platforms, we can't use asprintf(). --- Console.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Console.cpp b/Console.cpp index 7f68ecd..424c97f 100644 --- a/Console.cpp +++ b/Console.cpp @@ -965,9 +965,8 @@ int Main(int argc, char * const argv[], char const * const envp[]) { if (optarg + size != end) { // XXX: arg needs to be escaped in some horrendous way of doom // XXX: this is a memory leak now because I just don't care enough - char *command; - int writ(asprintf(&command, "ps axc|sed -e '/^ *[0-9]/{s/^ *\\([0-9]*\\)\\( *[^ ]*\\)\\{3\\} *-*\\([^ ]*\\)/\\3 \\1/;/^%s /{s/^[^ ]* //;q;};};d'", optarg)); - _assert(writ != -1); + CYPool pool; + char *command(pool.sprintf(strlen(optarg) + 256, "ps axc|sed -e '/^ *[0-9]/{s/^ *\\([0-9]*\\)\\( *[^ ]*\\)\\{3\\} *-*\\([^ ]*\\)/\\3 \\1/;/^%s /{s/^[^ ]* //;q;};};d'", optarg)); if (FILE *pids = popen(command, "r")) { char value[32]; -- 2.45.2