PGPRO-5646: remove compiler warning (gcc 11.2.0) #11
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.
In function ‘ptrack_write_chunk’,
inlined from ‘ptrackCheckpoint’ at engine.c:397:2:
engine.c:78:13: warning: ‘write’ reading 8 bytes from a region of size 4
[-Wstringop-overread]
78 | if (write(fd, chunk, size) != size)
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from engine.c:47:
engine.c: In function ‘ptrackCheckpoint’:
engine.h:55:25: note: source object ‘magic’ of size 4
55 | char magic[PTRACK_MAGIC_SIZE];
| ^~~~~
In file included from engine.c:22:
/usr/include/unistd.h:378:16: note: in a call to function ‘write’ declared with
attribute ‘access (read_only, 2, 3)’
378 | extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur
| ^~~~~
In C a pointer to the first field of a structure and a pointer to the structure
itself are always equal.