ia64/xen-unstable

changeset 18927:045f70d1acdb

xenpmd: Fix bogus fgets() size parameter.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Sat Dec 13 17:44:20 2008 +0000 (2008-12-13)
parents 6a3c2b4459ad
children 21bbb41f9af2
files tools/xenpmd/xenpmd.c
line diff
     1.1 --- a/tools/xenpmd/xenpmd.c	Sat Dec 13 15:56:16 2008 +0000
     1.2 +++ b/tools/xenpmd/xenpmd.c	Sat Dec 13 17:44:20 2008 +0000
     1.3 @@ -297,7 +297,6 @@ int get_next_battery_info_or_status(DIR 
     1.4      if  ( !info_or_status )
     1.5          return 0;
     1.6  
     1.7 -    memset(line_info, 0, 256);
     1.8      if (type == BIF) 
     1.9          memset(info_or_status, 0, sizeof(struct battery_info));
    1.10      else 
    1.11 @@ -307,11 +306,8 @@ int get_next_battery_info_or_status(DIR 
    1.12      if ( !file )
    1.13          return 0;
    1.14  
    1.15 -    while ( fgets(line_info, 1024, file) != NULL ) 
    1.16 -    {
    1.17 +    while ( fgets(line_info, sizeof(line_info), file) != NULL ) 
    1.18          parse_battery_info_or_status(line_info, type, info_or_status);
    1.19 -        memset(line_info, 0, 256);
    1.20 -    }
    1.21  
    1.22      fclose(file);
    1.23      return 1;