Skip to content

Commit

Permalink
Correct last clang warnings in readpassphrase
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben RUBSON authored Oct 20, 2017
1 parent d693858 commit 4293ce4
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions encfs/readpassphrase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,29 +126,30 @@ char *readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags) {
}

if (write(output, prompt, strlen(prompt)) != -1) {
end = buf + bufsiz - 1;
for (p = buf; (nr = read(input, &ch, 1)) == 1 && ch != '\n' && ch != '\r';) {
if (p < end) {
if ((flags & RPP_SEVENBIT) != 0) {
ch &= 0x7f;
//dummy test to get rid of warn_unused_result compilation warning
}
end = buf + bufsiz - 1;
for (p = buf; (nr = read(input, &ch, 1)) == 1 && ch != '\n' && ch != '\r';) {
if (p < end) {
if ((flags & RPP_SEVENBIT) != 0) {
ch &= 0x7f;
}
if (isalpha(ch) != 0) {
if ((flags & RPP_FORCELOWER) != 0) {
ch = tolower(ch);
}
if (isalpha(ch) != 0) {
if ((flags & RPP_FORCELOWER) != 0) {
ch = tolower(ch);
}
if ((flags & RPP_FORCEUPPER) != 0) {
ch = toupper(ch);
}
if ((flags & RPP_FORCEUPPER) != 0) {
ch = toupper(ch);
}
*p++ = ch;
}
*p++ = ch;
}
*p = '\0';
}
*p = '\0';
save_errno = errno;
if ((term.c_lflag & ECHO) == 0u) {
if(write(output, "\n", 1) != -1) {
//dummy test to get rid of warn_unused_result compilation warning
if (write(output, "\n", 1) != -1) {
//dummy test to get rid of warn_unused_result compilation warning
}
}

Expand Down

0 comments on commit 4293ce4

Please sign in to comment.