libmultipath: zero out lines in print.c
authorHannes Reinecke <hare@suse.de>
Fri, 14 Nov 2008 09:02:56 +0000 (10:02 +0100)
committerChristophe Varoqui <christophe.varoqui@free.fr>
Tue, 21 Apr 2009 21:53:55 +0000 (23:53 +0200)
static declaration of line within a function doesn't place them in
the bss segment, hence they are not zeroed automatically.
Gives funny effects occasionally.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath/print.c

index a2253be..986263f 100644 (file)
@@ -1303,6 +1303,7 @@ print_path (struct path * pp, char * style)
 {
        char line[MAX_LINE_LEN];
 
+       memset(&line[0], 0, MAX_LINE_LEN);
        snprint_path(&line[0], MAX_LINE_LEN, style, pp);
        printf("%s", line);
 }
@@ -1312,6 +1313,7 @@ print_multipath (struct multipath * mpp, char * style)
 {
        char line[MAX_LINE_LEN];
 
+       memset(&line[0], 0, MAX_LINE_LEN);
        snprint_multipath(&line[0], MAX_LINE_LEN, style, mpp);
        printf("%s", line);
 }
@@ -1321,6 +1323,7 @@ print_pathgroup (struct pathgroup * pgp, char * style)
 {
        char line[MAX_LINE_LEN];
 
+       memset(&line[0], 0, MAX_LINE_LEN);
        snprint_pathgroup(&line[0], MAX_LINE_LEN, style, pgp);
        printf("%s", line);
 }