Windows doesn't like quotes around "edit" when calling it through system().
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 21 Jul 2012 14:33:09 +0000 (16:33 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 21 Jul 2012 14:33:09 +0000 (16:33 +0200)
Even though that works fine on the command line.

src/tincctl.c

index f519e78d37792b07b3182a767e970f84336ba243..5f24ae4d5d5771763025f34a45396a020afa06c3 100644 (file)
@@ -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;