mirror of
https://github.com/uutils/coreutils
synced 2024-12-15 07:42:48 +00:00
mktemp: fix PrefixContainsDirSeparator verification
This commit is contained in:
parent
f610f33aa7
commit
af4ce911c8
1 changed files with 5 additions and 1 deletions
|
@ -281,7 +281,11 @@ impl Params {
|
||||||
.join(prefix_from_template)
|
.join(prefix_from_template)
|
||||||
.display()
|
.display()
|
||||||
.to_string();
|
.to_string();
|
||||||
if options.treat_as_template && prefix.contains(MAIN_SEPARATOR) {
|
|
||||||
|
// Check that the prefix is valid.
|
||||||
|
let prefix_of_template = Path::new(prefix_from_template).display().to_string();
|
||||||
|
|
||||||
|
if options.treat_as_template && prefix_of_template.contains(MAIN_SEPARATOR) {
|
||||||
return Err(MkTempError::PrefixContainsDirSeparator(options.template));
|
return Err(MkTempError::PrefixContainsDirSeparator(options.template));
|
||||||
}
|
}
|
||||||
if tmpdir.is_some() && Path::new(prefix_from_template).is_absolute() {
|
if tmpdir.is_some() && Path::new(prefix_from_template).is_absolute() {
|
||||||
|
|
Loading…
Reference in a new issue