From: Guus Sliepen Date: Sat, 21 Jul 2012 14:33:09 +0000 (+0200) Subject: Windows doesn't like quotes around "edit" when calling it through system(). X-Git-Tag: release-1.1pre3~83 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e5e96882c3825cee81ff163490b2f39fad3192b8;p=oweals%2Ftinc.git Windows doesn't like quotes around "edit" when calling it through system(). Even though that works fine on the command line. --- diff --git a/src/tincctl.c b/src/tincctl.c index f519e78..5f24ae4 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -1461,14 +1461,12 @@ static int cmd_edit(int argc, char *argv[]) { } } + char *command; #ifndef HAVE_MINGW - char *editor = getenv("VISUAL") ?: getenv("EDITOR") ?: "vi"; + xasprintf(&command, "\"%s\" \"%s\"", getenv("VISUAL") ?: getenv("EDITOR") ?: "vi", filename); #else - char *editor = "edit"; + xasprintf(&command, "edit \"%s\"", filename); #endif - - char *command; - xasprintf(&command, "\"%s\" \"%s\"", editor, filename); int result = system(command); if(result) return result;