1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Fix using deadcode and possible use of NULL pointer

Fix for deadcode in unique_create() so that "opened_name" parameter is
always initialized to a valid string or NULL when returning from
function.

Fix for redirect_output() so that "logfile" is not blindly used in
fprintf() call and checked if it is not NULL.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2013-04-26 14:42:30 +02:00 committed by Giuseppe Scrivano
parent 9e0d87a248
commit c9c0e4c641
3 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2013-04-26 Tomas Hozza <thozza@redhat.com> (tiny change)
* log.c (redirect_output): Use DEFAULT_LOGFILE in diagnostic message
when `logfile' is NULL.
* utils.c (unique_create): Ensure `logfile' has always a value.
2013-06-26 Darshit Shah <darnir@gmail.com>
* http.c (gethttp): Reverse change by commit 90896 that prevented

View File

@ -871,7 +871,7 @@ redirect_output (void)
can do but disable printing completely. */
fprintf (stderr, _("\n%s received.\n"), redirect_request_signal_name);
fprintf (stderr, _("%s: %s; disabling logging.\n"),
logfile, strerror (errno));
(logfile) ? logfile : DEFAULT_LOGFILE, strerror (errno));
inhibit_logging = true;
}
save_context_p = false;

View File

@ -703,7 +703,7 @@ unique_create (const char *name, bool binary, char **opened_name)
xfree (uname);
uname = unique_name (name, false);
}
if (opened_name && fp != NULL)
if (opened_name)
{
if (fp)
*opened_name = uname;