Also use the actual diff command we found instead of searching for it
again.
gssize len,
GError **error)
{
- const char *command[] = { "diff", "-u", file1, NULL, NULL };
- char *diff, *tmpfile;
+ char *diff_cmd, *diff, *tmpfile;
int fd;
diff = NULL;
- if (g_find_program_in_path ("diff"))
+ diff_cmd = g_find_program_in_path ("diff");
+ if (diff_cmd)
{
+ const char *command[] = { diff_cmd, "-u", file1, NULL, NULL };
+
if (len < 0)
len = strlen (text);
g_spawn_sync (NULL,
(char **) command,
NULL,
- G_SPAWN_SEARCH_PATH,
+ 0,
NULL, NULL,
&diff,
NULL, NULL,
done:
g_unlink (tmpfile);
g_free (tmpfile);
+ g_free (diff_cmd);
}
else
{