Open
Conversation
minminlittleshrimp
requested changes
Mar 17, 2026
| } | ||
|
|
||
| char *tosend = malloc(length); | ||
| #pragma GCC diagnostic push |
Collaborator
There was a problem hiding this comment.
Need proper fix
Contributor
Author
There was a problem hiding this comment.
This is for fixing failure:
error: '__builtin___snprintf_chk' output may be truncated before the last format character [-Werror=format-truncation=]
I have changed length to "size_t length = strlen(opts->Directory[j]) + strlen(ie->name) + 2;" , and then snprintf(tosend, length, "%s/%s", opts->Directory[j], ie->name); As I see, malloc tosend with length is enough. I don't understand why gcc still reported the failure, I did not find the proper way, so just skip it. Any suggestion? Thanks.
Contributor
Author
|
update the pull request title since I add another commit. |
Fix build failures when -DWITH_SYSTEMD=ON, -DWITH_SYSTEMD_WATCHDOG=ON,
-DWITH_SYSTEMD_JOURNAL=ON:
Eg:
src/system/dlt-system-syslog.c:91:39: error: conversion from 'int' to '__uint16_t' {aka 'short unsigned int'} may change value [-Werror=conversion]
91 | syslog_addr.sin6_port = htons(opts.Port);
| ~~~~^~~~~
src/system/dlt-system-logfile.c:74:21: error: conversion from 'size_t' {aka 'long unsigned int'} to 'int' may change value [-Werror=conversion]
74 | bytes = fread(buffer, 1, sizeof(buffer) - 1, pFile);
| ^~~~~
src/system/dlt-system-syslog.c:120:22: error: conversion from 'ssize_t' {aka 'long int'} to 'int' may change value [-Werror=conversion]
120 | int bytes_read = recvfrom(sock, recv_data, RECV_BUF_SZ, 0,
| ^~~~~~~~
src/system/dlt-system-logfile.c:76:23: error: comparison of unsigned expression in '>= 0' is always true [-Werror=type-limits]
76 | if (bytes >= 0)
| ^~
src/system/dlt-system-filetransfer.c:727:56: error: '__builtin___snprintf_chk' output may be truncated before the last format cha racter [-Werror=format-truncation=]
10 727 | snprintf(tosend, length, "%s/%s", opts->Directory[j], ie->name);
src/system/dlt-system-filetransfer.c:153: error: declaration of 'len' shadows a previous local [-Werror=shadow]
Signed-off-by: Changqing Li <changqing.li@windriver.com>
src/shared/dlt_common.c:6477:17: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] | 6477 | char *dot = strrchr(filename, '.'); [1] bminor/glibc@cd748a6 Signed-off-by: Changqing Li <changqing.li@windriver.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix build failures when -DWITH_SYSTEMD=ON, -DWITH_SYSTEMD_WATCHDOG=ON, -DWITH_SYSTEMD_JOURNAL=ON:
Eg:
src/system/dlt-system-syslog.c:91:39: error: conversion from 'int' to '__uint16_t' {aka 'short unsigned int'} may change value [-Werror=conversion]
91 | syslog_addr.sin6_port = htons(opts.Port);
| ~~~~^~~~~
src/system/dlt-system-logfile.c:74:21: error: conversion from 'size_t' {aka 'long unsigned int'} to 'int' may change value [-Werror=conversion]
74 | bytes = fread(buffer, 1, sizeof(buffer) - 1, pFile);
| ^~~~~
src/system/dlt-system-syslog.c:120:22: error: conversion from 'ssize_t' {aka 'long int'} to 'int' may change value [-Werror=conversion]
120 | int bytes_read = recvfrom(sock, recv_data, RECV_BUF_SZ, 0,
| ^~~~~~~~
src/system/dlt-system-logfile.c:76:23: error: comparison of unsigned expression in '>= 0' is always true [-Werror=type-limits]
76 | if (bytes >= 0)
| ^~
src/system/dlt-system-filetransfer.c:727:56: error: '__builtin___snprintf_chk' output may be truncated before the last format cha racter [-Werror=format-truncation=]
10 727 | snprintf(tosend, length, "%s/%s", opts->Directory[j], ie->name);
src/system/dlt-system-filetransfer.c:153: error: declaration of 'len' shadows a previous local [-Werror=shadow]