iscsi_parse_url: fix spurious compiler warnings

gcc-4.6.3 reports these:
  libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include "-D_U_=__attribute__((unused))" -Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -g -O2 -MT lib/init.lo -MD -MP -MF lib/.deps/init.Tpo -c lib/init.c  -fPIC -DPIC -o lib/.libs/init.o
  lib/init.c: In function 'iscsi_parse_url':
  lib/init.c:410:18: warning: 'l' may be used uninitialized in this function [-Wuninitialized]
  lib/init.c:409:10: warning: 'target' may be used uninitialized in this function [-Wuninitialized]

Both warnings appear to be spurious though, as both "target" and "l" are only used if
"full" is set, which implies that these are initialized before.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
This commit is contained in:
Arne Redlich
2012-10-31 14:34:30 +01:00
parent 6507f4050f
commit b910efa7c5

View File

@@ -308,10 +308,10 @@ iscsi_parse_url(struct iscsi_context *iscsi, const char *url, int full)
char *portal; char *portal;
char *user = NULL; char *user = NULL;
char *passwd = NULL; char *passwd = NULL;
char *target; char *target = NULL;
char *lun; char *lun;
char *tmp; char *tmp;
int l; int l = 0;
if (strncmp(url, "iscsi://", 8)) { if (strncmp(url, "iscsi://", 8)) {
if (full) { if (full) {