From aee1526ce71f788ba18fef6d9dc9f697655e7bbc Mon Sep 17 00:00:00 2001 From: Cy Schubert Date: Fri, 3 Nov 2017 13:08:29 +0000 Subject: [PATCH] While discussing the new gets_s.c in D12785, ed@ suggested putting {}'s around the if (c == EOF) block to prevent potential 'trailing else' issues from being introduced when refactoring. As my gets_s() code is based on this, it makes sense to fix the same issue here first here and now, then do an svn copy again to capture this history). Suggested by: ed@ in D12785 --- lib/libc/stdio/gets.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/stdio/gets.c b/lib/libc/stdio/gets.c index c75dcc202cc..06e56f7f0c3 100644 --- a/lib/libc/stdio/gets.c +++ b/lib/libc/stdio/gets.c @@ -61,13 +61,13 @@ gets(char *buf) warned = 1; } for (s = buf; (c = __sgetc(stdin)) != '\n'; ) { - if (c == EOF) + if (c == EOF) { if (s == buf) { ret = NULL; goto end; } else break; - else + } else *s++ = c; } *s = 0;