Commit 973e05f0 authored by Murray Cumming's avatar Murray Cumming

Use Glib::shell_quote() when spawning tar.

* glom/libglom/document/document.cc: Use Glib::shell_quote()
when spawning tar, instead of manually adding quotes.
parent 10da5796
2011-11-09 Murray Cumming <murrayc@murrayc.com>
Use Glib::shell_quote() when spawning tar.
* glom/libglom/document/document.cc: Use Glib::shell_quote()
when spawning tar, instead of manually adding quotes.
2011-11-09 Murray Cumming <murrayc@murrayc.com>
PostgreSQL backend: Use g_shell_quote().
......
......@@ -36,6 +36,7 @@
#include <giomm/file.h>
#include <glibmm/miscutils.h>
#include <glibmm/convert.h>
#include <glibmm/shell.h>
//#include <libglom/busy_cursor.h>
#include <libglom/connectionpool.h>
......@@ -4609,13 +4610,13 @@ Glib::ustring Document::save_backup_file(const Glib::ustring& uri, const SlotPro
const std::string tarball_path = path_dir + ".tar.gz";
//TODO: Find some way to do this without using the command-line,
//which feels fragile:
const std::string command_tar = "\"" + path_tar + "\"" +
const std::string command_tar = Glib::shell_quote(path_tar) +
" --force-local --no-wildcards" + //Avoid side-effects of special characters.
" --remove-files" +
" -czf"
" \"" + tarball_path + "\"" +
" --directory \"" + parent_dir + "\"" + //This must be right before the mention of the file name:
" \"" + basename + "\"";
" " + Glib::shell_quote(tarball_path) +
" --directory " + Glib::shell_quote(parent_dir) + //This must be right before the mention of the file name:
" " + Glib::shell_quote(basename);
//std::cout << "DEBUG: command_tar=" << command_tar << std::endl;
......@@ -4652,11 +4653,11 @@ Glib::ustring Document::restore_backup_file(const Glib::ustring& backup_uri, con
//Untar into the tmp directory:
//TODO: Find some way to do this without using the command-line,
//which feels fragile:
const std::string command_tar = "\"" + path_tar + "\"" +
const std::string command_tar = Glib::shell_quote(path_tar) +
" --force-local --no-wildcards" + //Avoid side-effects of special characters.
" -xzf"
" \"" + filename_tarball + "\"" +
" --directory \"" + path_tmp + "\"";
" " + Glib::shell_quote(filename_tarball) +
" --directory " + Glib::shell_quote(path_tmp);
//std::cout << "DEBUG: command_tar=" << command_tar << std::endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment