A new user interface for you! Read more...

File gcc7-error-xenpmd.patch of Package xen

gcc  -m64 -DBUILD_ID -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs   -g3 -O0 -fno-omit-frame-pointer -D__XEN_INTERFACE_VERSION__=__XEN_LATEST_INTERFACE_VERSION__ -MMD -MF .xenpmd.o.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE  -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -g -Werror -I/home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/tools/xenpmd/../../tools/xenstore/include -I/home/abuild/rpmbuild/BUILD/xen-4.9.0-testing/tools/xenpmd/../../tools/include  -c -o xenpmd.o xenpmd.c
xenpmd.c: In function 'get_next_battery_file':
xenpmd.c:90:36: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 19 [-Werror=format-truncation=]
     #define BATTERY_INFO_FILE_PATH "/tmp/battery/%s/info"
                                    ^
xenpmd.c:113:37: note: in expansion of macro 'BATTERY_INFO_FILE_PATH'
             snprintf(file_name, 32, BATTERY_INFO_FILE_PATH,
                                     ^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:939:0,
                 from xenpmd.c:35:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 19 and 274 bytes into a destination of size 32
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xenpmd.c:91:37: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 19 [-Werror=format-truncation=]
     #define BATTERY_STATE_FILE_PATH "/tmp/battery/%s/state"
                                     ^
xenpmd.c:116:37: note: in expansion of macro 'BATTERY_STATE_FILE_PATH'
             snprintf(file_name, 32, BATTERY_STATE_FILE_PATH,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:939:0,
                 from xenpmd.c:35:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 20 and 275 bytes into a destination of size 32
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: xen-4.9.0-testing/tools/xenpmd/xenpmd.c
===================================================================
--- xen-4.9.0-testing.orig/tools/xenpmd/xenpmd.c
+++ xen-4.9.0-testing/tools/xenpmd/xenpmd.c
@@ -100,7 +100,7 @@ FILE *get_next_battery_file(DIR *battery
 {
     FILE *file = 0;
     struct dirent *dir_entries;
-    char file_name[32];
+    char file_name[276];
     
     do 
     {
@@ -110,10 +110,10 @@ FILE *get_next_battery_file(DIR *battery
         if ( strlen(dir_entries->d_name) < 4 )
             continue;
         if ( battery_info_type == BIF ) 
-            snprintf(file_name, 32, BATTERY_INFO_FILE_PATH,
+            snprintf(file_name, 276, BATTERY_INFO_FILE_PATH,
                      dir_entries->d_name);
         else 
-            snprintf(file_name, 32, BATTERY_STATE_FILE_PATH,
+            snprintf(file_name, 276, BATTERY_STATE_FILE_PATH,
                      dir_entries->d_name);
         file = fopen(file_name, "r");
     } while ( !file );