Fix a gcc 4.6 warning. - susmb - mounting of SMB/CIFS shares via FUSE | |
git clone git://git.codemadness.org/susmb | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit a9d1e66e4f4fd1c6676937683e755cad185214fc | |
parent 150db4f0d374b806c68fcb78ec78e739396dded0 | |
Author: Geoff Johnstone <[email protected]> | |
Date: Sat, 25 Aug 2012 20:01:57 +0100 | |
Fix a gcc 4.6 warning. | |
Diffstat: | |
M password.c | 8 ++++++-- | |
1 file changed, 6 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/password.c b/password.c | |
@@ -50,12 +50,11 @@ bool password_read (char **out) | |
return false; | |
} | |
- bool ok = false; | |
char buff[1024]; | |
fputs ("\nPassword: ", stdout); | |
fflush (stdout); | |
- ok = (buff == fgets (buff, sizeof (buff), stdin)); | |
+ const bool ok = (buff == fgets (buff, sizeof (buff), stdin)); | |
fputc ('\n', stdout); | |
if (0 != tcsetattr (STDIN_FILENO, TCSAFLUSH, &attr)) | |
@@ -64,6 +63,11 @@ bool password_read (char **out) | |
fputs ("Failed to reset terminal.\n", stderr); | |
} | |
+ if (!ok) | |
+ { | |
+ return false; | |
+ } | |
+ | |
// strip a trailing '\n'. | |
{ | |
size_t len = strlen (buff); |