|
|
void | void |
open_cmd_tube (const gchar *cmd, const gchar *mount_point) | open_cmd_tube (const gchar *cmd, const gchar *mount_point) |
{ | { |
gint status; |
gchar error[MAXLINE], *line, *status; |
gchar error[MAXLINE], *line; |
FILE *sh; |
FILE *sh, *tmp; |
|
| |
setbuf(stdout, error); | setbuf(stdout, error); |
line = g_strconcat(cmd, " ", mount_point, " &> ", TUBE_NAME, NULL); |
line = g_strconcat(cmd, " ", mount_point, " 2>&1", NULL); |
sh = popen(line, "r"); | sh = popen(line, "r"); |
g_free(line); | g_free(line); |
| |
status = pclose(sh); |
status = fgets(error, MAXLINE-1, sh); |
|
|
if (status == 0) { |
if (status && (pclose(sh) != 0)) |
remove(TUBE_NAME); |
|
gui_list_main_update(GTK_TREE_VIEW(list_treeview)); |
|
|
|
return; |
|
} else { |
|
if ((tmp = fopen(TUBE_NAME, "r")) == NULL) { |
|
gui_list_main_update(GTK_TREE_VIEW(list_treeview)); |
|
|
|
return; |
|
} |
|
if (fgets(error, MAXLINE-1, tmp) == NULL) { |
|
fclose(tmp); |
|
remove(TUBE_NAME); |
|
gui_list_main_update(GTK_TREE_VIEW(list_treeview)); |
|
|
|
return; |
|
} |
|
fclose(tmp); |
|
remove(TUBE_NAME); |
|
error_window(error); | error_window(error); |
} |
|
gui_list_main_update(GTK_TREE_VIEW(list_treeview)); | gui_list_main_update(GTK_TREE_VIEW(list_treeview)); |
|
|
return; | return; |
} | } |
| |