Fixed some quoating issues

Thanks to Sebastinas
This commit is contained in:
Moritz Lipp 2010-07-23 13:58:53 +02:00
parent 68fc126c8a
commit 56284b9fd1
2 changed files with 8 additions and 5 deletions

View file

@ -52,10 +52,10 @@ char* default_text = "[No Name]";
/* printing */ /* printing */
char* list_printer_command = "lpstat -v | sed -n '/^.*device for \\(.*\\): .*$/s//\\1/p'"; char* list_printer_command = "lpstat -v | sed -n '/^.*device for \\(.*\\): .*$/s//\\1/p'";
char* print_command = "lp -d '%s' -P %s %s '%s'"; /* printer / pages / file */ char* print_command = "lp -d '%s' -P %s %s %s"; /* printer / pages / file */
/* open uri */ /* open uri */
char* uri_command = "firefox '%s'"; /* uri */ char* uri_command = "firefox %s"; /* uri */
/* additional settings */ /* additional settings */
gboolean show_scrollbars = FALSE; gboolean show_scrollbars = FALSE;

View file

@ -1341,7 +1341,7 @@ open_file(char* path, char* password)
void open_uri(char* uri) void open_uri(char* uri)
{ {
char* escaped_uri = g_strescape(uri, NULL); char* escaped_uri = g_shell_quote(uri);
char* uri_cmd = g_strdup_printf(uri_command, escaped_uri); char* uri_cmd = g_strdup_printf(uri_command, escaped_uri);
system(uri_cmd); system(uri_cmd);
g_free(uri_cmd); g_free(uri_cmd);
@ -3301,13 +3301,16 @@ cmd_print(int argc, char** argv)
addit = g_string_append(addit, argv[i]); addit = g_string_append(addit, argv[i]);
} }
char* escaped_filename = g_strescape(Zathura.PDF.file, NULL); char* escaped_filename = g_shell_quote(Zathura.PDF.file);
char* command = g_strdup_printf(print_command, printer, sites, addit->str, escaped_filename); char* escaped_addit = g_shell_quote(addit->str);
char* command = g_strdup_printf(print_command, printer, sites, escaped_addit, escaped_filename);
system(command); system(command);
g_free(sites); g_free(sites);
g_free(escaped_filename); g_free(escaped_filename);
g_free(escaped_addit);
g_free(command); g_free(command);
g_string_free(addit, TRUE);
return TRUE; return TRUE;
} }