path: root/pseudo_wrappers.c
diff options
authorPeter Seebach <peter.seebach@windriver.com>2011-07-19 15:50:40 -0500
committerPeter Seebach <peter.seebach@windriver.com>2011-07-19 15:50:40 -0500
commit4a646c8bbe73ca830cb8c2e80be4b457d925cdd4 (patch)
tree29341fe4bb0996df0bb3dce7187b97aa732a373e /pseudo_wrappers.c
parentc2f7c5ad8ef0f9c94a2a8382c109c8c6e16c8b18 (diff)
Fix uninitalized variable.
You might be wondering why this wasn't caught. Answer: gcc's too smart. Consider: int x; if (condition) x = 23; return x; This function will just return 23. Since gcc knows that it doesn't matter what happens if x is used uninitialized (it's an indeterminate value, thus a possible trap representation, thus undefined behavior to use it), it simplifies the initial part of this away. Thus there's no use of an uninitialized value. Something similar seems to be at issue with the use of the uninitialized f in pseudo_init_one_wrapper. The variable wasn't initialized in the pre-realpath-fix version either, but in that version, the assignment from dlsym was completely unconditional.
Diffstat (limited to 'pseudo_wrappers.c')
1 files changed, 2 insertions, 1 deletions
diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c
index 07a4429..f11f172 100644
--- a/pseudo_wrappers.c
+++ b/pseudo_wrappers.c
@@ -92,7 +92,8 @@ pseudo_reinit_libpseudo(void) {
static void
pseudo_init_one_wrapper(pseudo_function *func) {
- int (*f)(void);
+ int (*f)(void) = (int (*)(void)) NULL;
char *e;
if (*func->real != NULL) {
/* already initialized */