Correct a small issue with encfsctl cat --reverse (#489)

If user provides a path with a leading slash, in reverse mode, it will be converted to '+' by plainpath, and will fail to decode.
This commit is contained in:
Ben RUBSON 2018-03-19 22:29:35 +01:00 committed by GitHub
parent 4f3e0bae09
commit 154839d67c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -429,6 +429,11 @@ static int cmd_cat(int argc, char **argv) {
if (!rootInfo) return EXIT_FAILURE; if (!rootInfo) return EXIT_FAILURE;
const char *path = argv[0]; const char *path = argv[0];
// If user provides a leading slash, in reverse mode, it will be converted
// to "+" by plainpath, and will fail to decode... Workaround below then...
if (path[0] == '/') {
path++;
}
WriteOutput output(STDOUT_FILENO); WriteOutput output(STDOUT_FILENO);
int errCode = processContents(rootInfo, path, output); int errCode = processContents(rootInfo, path, output);