mirror of
https://github.com/samba-team/samba.git
synced 2025-02-28 01:58:17 +03:00
r24897: Do some sanity checking on --basedir.
(This used to be commit 32dbaa142a2514d011a91ba0a0026934305e295f)
This commit is contained in:
parent
e561313888
commit
dcb925bba7
@ -651,7 +651,20 @@ int main(int argc,char *argv[])
|
||||
}
|
||||
|
||||
torture = torture_context_init(talloc_autofree_context(), ui_ops);
|
||||
torture->outputdir = basedir;
|
||||
if (basedir != NULL) {
|
||||
if (basedir[0] != '/') {
|
||||
fprintf(stderr, "Please specify an absolute path to --basedir\n");
|
||||
return 1;
|
||||
}
|
||||
torture->outputdir = basedir;
|
||||
} else {
|
||||
char *pwd = talloc_size(torture, PATH_MAX);
|
||||
if (!getcwd(pwd, PATH_MAX)) {
|
||||
fprintf(stderr, "Unable to determine current working directory\n");
|
||||
return 1;
|
||||
}
|
||||
torture->outputdir = pwd;
|
||||
}
|
||||
|
||||
if (argc_new == 0) {
|
||||
printf("You must specify a test to run, or 'ALL'\n");
|
||||
|
@ -28,9 +28,10 @@
|
||||
create a temporary directory.
|
||||
*/
|
||||
_PUBLIC_ NTSTATUS torture_temp_dir(struct torture_context *tctx,
|
||||
const char *prefix,
|
||||
char **tempdir)
|
||||
const char *prefix,
|
||||
char **tempdir)
|
||||
{
|
||||
SMB_ASSERT(tctx->outputdir != NULL);
|
||||
*tempdir = talloc_asprintf(tctx, "%s/%s.XXXXXX", tctx->outputdir, prefix);
|
||||
|
||||
if (mkdtemp(*tempdir) == NULL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user