|
|
226bdc |
From 613d8639c48b950f76d132b70d27e518ba6d6891 Mon Sep 17 00:00:00 2001
|
|
|
226bdc |
From: Tomas Hozza <thozza@redhat.com>
|
|
|
226bdc |
Date: Fri, 26 Apr 2013 14:42:30 +0200
|
|
|
226bdc |
Subject: [PATCH] Fix using deadcode and possible use of NULL pointer
|
|
|
226bdc |
|
|
|
226bdc |
Fix for deadcode in unique_create() so that "opened_name" parameter is
|
|
|
226bdc |
always initialized to a valid string or NULL when returning from
|
|
|
226bdc |
function.
|
|
|
226bdc |
|
|
|
226bdc |
Fix for redirect_output() so that "logfile" is not blindly used in
|
|
|
226bdc |
fprintf() call and checked if it is not NULL.
|
|
|
226bdc |
|
|
|
226bdc |
Signed-off-by: Tomas Hozza <thozza@redhat.com>
|
|
|
226bdc |
---
|
|
|
226bdc |
src/log.c | 2 +-
|
|
|
226bdc |
src/utils.c | 2 +-
|
|
|
226bdc |
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
|
226bdc |
|
|
|
226bdc |
diff --git a/src/log.c b/src/log.c
|
|
|
226bdc |
index 0185df1..4f93a21 100644
|
|
|
226bdc |
--- a/src/log.c
|
|
|
226bdc |
+++ b/src/log.c
|
|
|
226bdc |
@@ -871,7 +871,7 @@ redirect_output (void)
|
|
|
226bdc |
can do but disable printing completely. */
|
|
|
226bdc |
fprintf (stderr, _("\n%s received.\n"), redirect_request_signal_name);
|
|
|
226bdc |
fprintf (stderr, _("%s: %s; disabling logging.\n"),
|
|
|
226bdc |
- logfile, strerror (errno));
|
|
|
226bdc |
+ (logfile) ? logfile : DEFAULT_LOGFILE, strerror (errno));
|
|
|
226bdc |
inhibit_logging = true;
|
|
|
226bdc |
}
|
|
|
226bdc |
save_context_p = false;
|
|
|
226bdc |
diff --git a/src/utils.c b/src/utils.c
|
|
|
226bdc |
index 567dc35..7cc942f 100644
|
|
|
226bdc |
--- a/src/utils.c
|
|
|
226bdc |
+++ b/src/utils.c
|
|
|
226bdc |
@@ -703,7 +703,7 @@ unique_create (const char *name, bool binary, char **opened_name)
|
|
|
226bdc |
xfree (uname);
|
|
|
226bdc |
uname = unique_name (name, false);
|
|
|
226bdc |
}
|
|
|
226bdc |
- if (opened_name && fp != NULL)
|
|
|
226bdc |
+ if (opened_name)
|
|
|
226bdc |
{
|
|
|
226bdc |
if (fp)
|
|
|
226bdc |
*opened_name = uname;
|
|
|
226bdc |
--
|
|
|
226bdc |
1.8.1.4
|
|
|
226bdc |
|