When executing an action with elevated privileges file ioslave directly checks errno
and then decides whether to continue or not. Since errno can change frequently
between function call it should not be relied upon.
With this patch after a function fails errno value is saved and then that saved value
is used wherever required.
Details
- Reviewers
dfaure - Commits
- R241:27aa3764c0bf: Improve error handling in file ioslave
Diff Detail
- Repository
- R241 KIO
- Branch
- master
- Lint
No Linters Available - Unit
No Unit Test Coverage
src/ioslaves/file/file_unix.cpp | ||
---|---|---|
122 | Why errno here? What sets it? Shouldn't that be errcode? | |
815 | What happened to the code that was passing socketPath() for OPEN and OPENDIR? It wasn't needed? | |
src/ioslaves/file/file_win.cpp | ||
392 | Why not just return the errcode that was given as input? |
errno -> errcode
KIO::ERR_ACCESS_DENIED -> err
socketPath is passed as an argument in line 106
No method in FileProtocol calls execWithElevatedPrivilege with OPENDIR action. If one does in future then we can pass socetPath() as argument there.
Ah OK so it was dead code. Removing dead code is always good.
The patch looks ok to me now -- assuming the unittests still pass, which you didn't mention in the testing section of this review request.