tools:acrn-crashlog: fix the compiling error on gcc version 9.0.1

Meet compiling error:

In function ‘strncpy’,
    inlined from ‘main’ at main.c:88:4:
/usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’
specified bound 4096 equals destination size
[-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos
(__dest));
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

This patch aims to fix it.

Tracked-On: #1024
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen, Gang <gang.c.chen@intel.com>
This commit is contained in:
Liu, Xinwu 2019-04-25 12:40:22 +08:00 committed by ACRN System Integration
parent bed57dd242
commit 0b37fc0b17

View File

@ -85,7 +85,7 @@ int main(int argc, char *argv[])
NULL)) != -1) {
switch (op) {
case 'c':
strncpy(cfg, optarg, PATH_MAX);
strncpy(cfg, optarg, PATH_MAX - 1);
break;
case 'h':
usage();