Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
rsm
Commits
de42cb8e
Commit
de42cb8e
authored
May 08, 2020
by
Huff, Israel
Browse files
added more error-checking to sftp file read/write
parent
546cf4d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
rsmcore/session.cc
View file @
de42cb8e
...
...
@@ -239,6 +239,7 @@ bool SFTPFile::isOpen() { return (p->file != nullptr); }
// on error, returns < 0 and ssh and sftp session errors are set
int64_t
SFTPFile
::
write
(
QString
str
)
{
if
(
nullptr
==
p
->
file
)
return
-
1
;
std
::
string
stdStr
=
str
.
toStdString
();
const
char
*
buf
=
stdStr
.
c_str
();
size_t
count
=
strlen
(
buf
);
...
...
@@ -250,7 +251,7 @@ int64_t SFTPFile::write(QString str)
// success
QString
SFTPFile
::
read
(
size_t
nBytes
)
{
if
(
nBytes
==
0
)
return
QString
();
if
(
nullptr
==
p
->
file
||
nBytes
==
0
)
return
QString
();
char
*
buf
=
new
char
[
nBytes
+
1
];
// initialize buff
memset
(
buf
,
0
,
nBytes
+
1
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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