Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
System
KPMCore
Commits
4ef17463
Commit
4ef17463
authored
Feb 05, 2022
by
Andrius Štikonas
Browse files
Make sure that path passed to WriteData is block device.
parent
81a5eae6
Pipeline
#133454
passed with stage
in 3 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/util/externalcommandhelper.cpp
View file @
4ef17463
...
...
@@ -291,7 +291,7 @@ QByteArray ExternalCommandHelper::ReadData(const QString& device, const qint64 o
if
(
length
>
MiB
)
{
return
{};
}
if
(
!
std
::
filesystem
::
is_block_file
(
device
.
toStdString
()))
{
if
(
!
std
::
filesystem
::
is_block_file
(
device
.
toStd
U16
String
()))
{
qWarning
()
<<
"Not a block device"
;
return
{};
}
...
...
@@ -313,7 +313,15 @@ bool ExternalCommandHelper::WriteData(const QByteArray& buffer, const QString& t
if
(
targetDevice
.
left
(
5
)
!=
QStringLiteral
(
"/dev/"
)
)
return
false
;
return
writeData
(
targetDevice
,
buffer
,
targetOffset
);
auto
targetPath
=
std
::
filesystem
::
path
(
targetDevice
.
toStdU16String
());
if
(
!
std
::
filesystem
::
is_block_file
(
targetDevice
.
toStdU16String
()))
{
qWarning
()
<<
"Not a block device"
;
return
{};
}
auto
canonicalTargetPath
=
std
::
filesystem
::
canonical
(
targetPath
);
return
writeData
(
QLatin1String
(
canonicalTargetPath
.
c_str
()),
buffer
,
targetOffset
);
}
QVariantMap
ExternalCommandHelper
::
RunCommand
(
const
QString
&
command
,
const
QStringList
&
arguments
,
const
QByteArray
&
input
,
const
int
processChannelMode
)
...
...
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