The gcc 4.8.2 on Ubuntu 14.04 complains about two different
types of issues that we've not seen older compilers complain about.
The complaints are warnings that are turned into errors, due to
our use of -Werror. The first type of error involves fprintf:
error: format not a string literal and no format arguments
I've found the following explanation for this change in gcc behavior:
If -Wformat is specified, also warn about uses of format
functions that represent possible security problems. At present,
this warns about calls to "printf" and "scanf" functions where
the format string is not a string literal and there are no format
arguments, as in "printf (foo);". This may be a security hole if
the format string came from untrusted input and contains %n.
(This is currently a subset of what -Wformat-nonliteral warns
about, but in future warnings may be added to -Wformat-security
that are not included in -Wformat-nonliteral.)
The second type of error is for not checking the return value of fgets.
This patch fixes these two issues and resolved the compilation problems.
Signed-off-by: Maynard Johnson <email@example.com>