On 06/27/2011 10:16 AM, Eric Blake wrote:
CC dutil_linux.lo
dutil_linux.c: In function ‘run_program’:
dutil_linux.c:201:11: warning: ‘childpid’ may be used uninitialized in this function
ACK and pushed.
I'm wondering why I don't see this warning though. Here's the
commandline (buried down in a script I never look at) I use to build netcf:
./autogen.sh --enable-compile-warnings=error --prefix=/usr
--libdir=/usr/lib64 --disable-nls CFLAGS="-g -Wformat -Wformat-security
-Winit-self -Wall -Wpointer-arith -Wextra -Wshadow -Wcast-align
-Wwrite-strings -Winline -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2
-Dlint" LDFLAGS=
* src/dutil_linux.c (run_program): Initialize variable.
---
src/dutil_linux.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/dutil_linux.c b/src/dutil_linux.c
index 841c2a1..1a3a86e 100644
--- a/src/dutil_linux.c
+++ b/src/dutil_linux.c
@@ -1,7 +1,7 @@
/*
* dutil_linux.c: Linux utility functions for driver backends.
*
- * Copyright (C) 2009 Red Hat Inc.
+ * Copyright (C) 2009, 2011 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -198,7 +198,7 @@ error:
int run_program(struct netcf *ncf, const char *const *argv, char **output)
{
- pid_t childpid;
+ pid_t childpid = -1;
int exitstatus, waitret;
char *argv_str;
int ret = -1;