Update FAQ about gets() -> fgets() change

I gave example output of a program where not changing it caused
confusing output, particularly in macOS, which is one of the strongest
reasons to make the change as it affects usability (in that it can make
one wonder what to do albeit probably briefly so).
This commit is contained in:
Cody Boone Ferguson committed 2023-10-11 03:18:29 -07:00
1 parent 44728e695b
commit 68aa94da20
1 file changed
+17 -9
+17 -9
View File
@@ -95,16 +95,23 @@ because of alarming warnings that can be displayed, in some systems at runtime
interspersed with the output of the program.
For instance in macOS the entry [1990/tbr](1990/tbr/README.md) would output the
warning in such a way that caused confusing output for the entry.
warning in such a way that caused confusing output for the entry, looking like:
In some cases this is not so easy to fix and in one case at least there is an
alternate version that has the fix instead due to a problem it creates (correct
output but segfaults after the output in one of the forms of input).
```sh
$ ./tbr
$ warning: this program uses gets(), which is unsafe.
# nothing here, what to do?
```
In some cases it is not possible to fix or at least highly unlikely and so those
have mainly not been touched except one that has had the buffer size increased
(which could be done for others that are not possible to change to `fgets()` but
this has not been done).
In some cases changing the code to use `fgets()` is not so easy to fix and in
one case at least there is an alternate version that has the fix instead due to
a problem it creates (correct output but segfaults after the output in one of
the forms of input).
In some cases it is not possible to fix or at least it is highly unlikely and so
those have mainly not been touched except one that has had the buffer size
increased (which could be done for others that are not possible to change to
`fgets()` though this has not been done).
Some entries can be made to look almost identical to the original entry. For
instance the fix to [1988/reddy](1988/reddy/README.md) required only a single
@@ -115,7 +122,8 @@ these problems.
NOTE: due to 'compatibility reasons' `fgets()` stores the newline and `gets()`
does not. We're not sure how this is compatibility but either way it can cause a
problem and it is this that has complicated some fixes.
problem and it is this that has complicated most of the fixes though again some
can look almost identical.
## Q: I cannot get entry XYZZY from year 19xx to compile!