mirror of
https://github.com/webmin/webmin.git
synced 2025-07-23 00:30:33 +00:00
Fix bad file descriptor error https://forum.virtualmin.com/t/sql-execution-sql-backup-restore-fails/123116
This commit is contained in:
@ -1028,19 +1028,20 @@ sub execute_sql_file
|
||||
if (&is_readonly_mode()) {
|
||||
return (0, undef);
|
||||
}
|
||||
-r $file || return (1, "$file does not exist");
|
||||
local ($db, $file, $user, $pass) = @_;
|
||||
local $authstr = &make_authstr($user, $pass);
|
||||
local $cs = $sql_charset ? "--default-character-set=".quotemeta($sql_charset)
|
||||
: "";
|
||||
local $temp = &transname();
|
||||
$file = &fix_collation($file);
|
||||
&open_tempfile(TEMP, ">$temp");
|
||||
&print_tempfile(TEMP, "source ".&fix_collation($file).";\n");
|
||||
&print_tempfile(TEMP, "source ".$file.";\n");
|
||||
&close_tempfile(TEMP);
|
||||
&set_ownership_permissions(undef, undef, 0644, $temp);
|
||||
&set_authstr_env();
|
||||
local $cmd = "$config{'mysql'} $authstr -t ".quotemeta($db)." ".$cs.
|
||||
" <".quotemeta($temp);
|
||||
-r $file || return (1, "$file does not exist");
|
||||
if ($_[4] && $_[4] ne 'root' && $< == 0) {
|
||||
# Restoring as a Unix user
|
||||
$cmd = &command_as_user($_[4], 0, $cmd);
|
||||
|
Reference in New Issue
Block a user