--- graveman-0.3.12-5.old/src/sox.c +++ graveman-0.3.12-5/src/sox.c @@ -37,7 +37,7 @@ gboolean check_sox() { gchar *Lsox = conf_get_string("sox"); - gchar *Lcommandline, *Lerr = NULL; + gchar *Lcommandline, *outbuf = NULL, *errbuf = NULL; gboolean Lstatus; gint Lexit = 0; @@ -47,14 +47,27 @@ if (!Lsox || !*Lsox) return FALSE; Lcommandline = g_strdup_printf("%s -help", conf_get_string("sox")); - Lstatus = g_spawn_command_line_sync(Lcommandline, NULL, &Lerr, &Lexit, NULL); + Lstatus = g_spawn_command_line_sync (Lcommandline, + &outbuf, &errbuf, &Lexit, NULL); g_free(Lcommandline); - GsupportMp3 = (Lstatus == TRUE && Lerr && ((strstr(Lerr, SOX_MP3)))); - GsupportOgg = (Lstatus == TRUE && Lerr && ((strstr(Lerr, SOX_OGG)))); - - g_free(Lerr); + if (Lstatus == TRUE) + { + if (errbuf) + { + if (strstr (errbuf, SOX_MP3)) GsupportMp3 = TRUE; + if (strstr (errbuf, SOX_OGG)) GsupportOgg = TRUE; + } + + if (outbuf) + { + if (strstr (outbuf, SOX_MP3)) GsupportMp3 = TRUE; + if (strstr (outbuf, SOX_OGG)) GsupportOgg = TRUE; + } + } + g_free (errbuf); + g_free (outbuf); return Lstatus; }