Quote MySQL backup destination filename
authorJamie Cameron <jcameron@webmin.com>
Tue, 25 Jan 2011 00:21:15 +0000 (16:21 -0800)
committerJamie Cameron <jcameron@webmin.com>
Tue, 25 Jan 2011 00:21:15 +0000 (16:21 -0800)
https://sourceforge.net/tracker/?func=detail&atid=117457&aid=3164971&group_id=17457

mysql/mysql-lib.pl

index 753cd50..e2af7d5 100755 (executable)
@@ -1335,13 +1335,13 @@ sub backup_database
 local ($db, $file, $compress, $drop, $where, $charset, $compatible,
        $tables, $user, $single) = @_;
 if ($compress == 0) {
-       $writer = ">$file";
+       $writer = ">".quotemeta($file);
        }
 elsif ($compress == 1) {
-       $writer = "| gzip -c >$file";
+       $writer = "| gzip -c >".quotemeta($file);
        }
 elsif ($compress == 2) {
-       $writer = "| bzip2 -c >$file";
+       $writer = "| bzip2 -c >".quotemeta($file);
        }
 local $dropsql = $drop ? "--add-drop-table" : "";
 local $singlesql = $single ? "--single-transaction" : "";