This kind of warning (used with -Werror) breaks all sysutils/xentools*
builds with gcc >= 7.

I started fixing some for xentools48, but ran out of time and gave up
on xen instead.

Martin
$NetBSD$

Elide string truncation warning with newer gcc.

--- tools/xenpmd/xenpmd.c.orig  2018-01-23 14:49:58.000000000 +0100
+++ tools/xenpmd/xenpmd.c       2019-03-21 14:36:51.861782226 +0100
@@ -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[FILENAME_MAX];
     
     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, sizeof(file_name), BATTERY_INFO_FILE_PATH,
                      dir_entries->d_name);
         else 
-            snprintf(file_name, 32, BATTERY_STATE_FILE_PATH,
+            snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
                      dir_entries->d_name);
         file = fopen(file_name, "r");
     } while ( !file );
$NetBSD$

Elide string truncation warning with newer gcc.

--- tools/misc/xenlockprof.c.orig       2018-01-23 14:49:58.000000000 +0100
+++ tools/misc/xenlockprof.c    2019-03-21 14:29:57.595339322 +0100
@@ -24,7 +24,7 @@ int main(int argc, char *argv[])
     uint32_t           i, j, n;
     uint64_t           time;
     double             l, b, sl, sb;
-    char               name[60];
+    char               name[100];
     DECLARE_HYPERCALL_BUFFER(xc_lockprof_data_t, data);
 
     if ( (argc > 2) || ((argc == 2) && (strcmp(argv[1], "-r") != 0)) )

Reply via email to