Explicitly override only newlines
Override only newlines with '\0' to avoid undesired truncation of actual line content. Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
This commit is contained in:
committed by
Serge Hallyn
parent
37ae232080
commit
ffc480c2e9
@ -71,7 +71,8 @@ static bool is_listed (const char *cfgin, const char *tty, bool def)
|
||||
*/
|
||||
|
||||
while (fgets (buf, (int) sizeof (buf), fp) != NULL) {
|
||||
buf[strlen (buf) - 1] = '\0';
|
||||
/* Remove optional trailing '\n'. */
|
||||
buf[strcspn (buf, "\n")] = '\0';
|
||||
if (strcmp (buf, tty) == 0) {
|
||||
(void) fclose (fp);
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user