Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c48a3d79
Commit
c48a3d79
authored
Aug 08, 2007
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use "create_temp_file" to create a temporary file name for the perl script
parent
5501f528
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
client/mysqltest.c
client/mysqltest.c
+17
-8
No files found.
client/mysqltest.c
View file @
c48a3d79
...
@@ -2970,8 +2970,10 @@ void do_send_quit(struct st_command *command)
...
@@ -2970,8 +2970,10 @@ void do_send_quit(struct st_command *command)
void
do_perl
(
struct
st_command
*
command
)
void
do_perl
(
struct
st_command
*
command
)
{
{
int
error
;
int
error
;
char
buf
[
FN_REFLEN
]
;
File
fd
;
FILE
*
res_file
;
FILE
*
res_file
;
char
buf
[
FN_REFLEN
];
char
temp_file_path
[
FN_REFLEN
];
static
DYNAMIC_STRING
ds_script
;
static
DYNAMIC_STRING
ds_script
;
static
DYNAMIC_STRING
ds_delimiter
;
static
DYNAMIC_STRING
ds_delimiter
;
const
struct
command_arg
perl_args
[]
=
{
const
struct
command_arg
perl_args
[]
=
{
...
@@ -2994,14 +2996,17 @@ void do_perl(struct st_command *command)
...
@@ -2994,14 +2996,17 @@ void do_perl(struct st_command *command)
DBUG_PRINT
(
"info"
,
(
"Executing perl: %s"
,
ds_script
.
str
));
DBUG_PRINT
(
"info"
,
(
"Executing perl: %s"
,
ds_script
.
str
));
/* Format a name for a tmp .pl file that is unique for this process */
/* Create temporary file name */
my_snprintf
(
buf
,
sizeof
(
buf
),
"%s/tmp/tmp_%d.pl"
,
if
((
fd
=
create_temp_file
(
temp_file_path
,
getenv
(
"MYSQLTEST_VARDIR"
),
getenv
(
"MYSQLTEST_VARDIR"
),
getpid
());
"tmp"
,
O_CREAT
|
O_SHARE
|
O_RDWR
,
str_to_file
(
buf
,
ds_script
.
str
,
ds_script
.
length
);
MYF
(
MY_WME
)))
<
0
)
die
(
"Failed to create temporary file for perl command"
);
my_close
(
fd
,
MYF
(
0
));
str_to_file
(
temp_file_path
,
ds_script
.
str
,
ds_script
.
length
);
/* Format the perl <filename> command */
/* Format the "perl <filename>" command */
my_snprintf
(
buf
,
sizeof
(
buf
),
"perl %s/tmp/tmp_%d.pl"
,
my_snprintf
(
buf
,
sizeof
(
buf
),
"perl %s"
,
temp_file_path
);
getenv
(
"MYSQLTEST_VARDIR"
),
getpid
());
if
(
!
(
res_file
=
popen
(
buf
,
"r"
))
&&
command
->
abort_on_error
)
if
(
!
(
res_file
=
popen
(
buf
,
"r"
))
&&
command
->
abort_on_error
)
die
(
"popen(
\"
%s
\"
,
\"
r
\"
) failed"
,
buf
);
die
(
"popen(
\"
%s
\"
,
\"
r
\"
) failed"
,
buf
);
...
@@ -3019,6 +3024,10 @@ void do_perl(struct st_command *command)
...
@@ -3019,6 +3024,10 @@ void do_perl(struct st_command *command)
}
}
}
}
error
=
pclose
(
res_file
);
error
=
pclose
(
res_file
);
/* Remove the temporary file */
my_delete
(
temp_file_path
,
MYF
(
0
));
handle_command_error
(
command
,
WEXITSTATUS
(
error
));
handle_command_error
(
command
,
WEXITSTATUS
(
error
));
dynstr_free
(
&
ds_script
);
dynstr_free
(
&
ds_script
);
dynstr_free
(
&
ds_delimiter
);
dynstr_free
(
&
ds_delimiter
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment