multipath-tools/multipath-tools-zero-lines-in-print.c

41 lines
1.2 KiB
C

commit 8fe887aa6875dfbb5057c9b1e4e8c91445700de5
Author: Hannes Reinecke <hare@suse.de>
Date: Fri Nov 14 10:02:56 2008 +0100
libmultipath: zero out lines in print.c
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>
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 6d80248..46ae2ec 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -1246,6 +1246,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);
}
@@ -1255,6 +1256,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);
}
@@ -1264,6 +1266,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);
}