Hi, this is a follow up for the three fix I've sent. I want to point that such warnings only show when tar is compiled with -O0, probably because with compiler optimizations the offending code is elided.
$ make -s WERROR_CFLAGS= CFLAGS=-O0 CC buffer.o In file included from buffer.c:22: buffer.c: In function ‘_open_archive’: ../lib/system.h:150:18: warning: too many arguments for format [-Wformat-extra-args] 150 | #define _(msgid) gettext (msgid) | ^~~~~~~~~~~~~~~ buffer.c:727:21: note: in expansion of macro ‘_’ 727 | paxfatal (0, 0, _("Invalid value for record_size")); | ^ CC exclist.o exclist.c: In function ‘info_attach_exclist’: exclist.c:83:11: warning: check of ‘dir’ for NULL after already dereferencing it [-Wanalyzer-deref-before-check] 83 | if (faccessat (dir ? dir->fd : chdir_fd, file->name, F_OK, 0) == 0) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ‘info_attach_exclist’: events 1-6 | | 79 | if (dir->exclude_list) | | ~~~~^~~~~~~~~~~~~~ | | | | | | | (1) pointer ‘dir’ is dereferenced here | | (2) following ‘false’ branch... | 80 | return; | 81 | for (file = excfile_head; file; file = file->next) | | ~~~~~~~~~~~~~~~~~~~ ~~~~ | | | | | | | (4) following ‘true’ branch (when ‘file’ is non-NULL)... | | (3) ...to here | 82 | { | 83 | if (faccessat (dir ? dir->fd : chdir_fd, file->name, F_OK, 0) == 0) | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | | | (5) ...to here | | (6) pointer ‘dir’ is checked for NULL here but it was already dereferenced at (1) | CC system.o system.c: In function ‘sys_exec_info_script’: system.c:841:12: warning: use of possibly-NULL ‘fp’ where non-null expected [CWE-690] [-Wanalyzer-possible-null-argument] 841 | rc = getline (&buf, &size, fp); | ^~~~~~~~~~~~~~~~~~~~~~~~~ ‘sys_exec_info_script’: events 1-4 | | 829 | if (pid != 0) | | ^ | | | | | (1) following ‘true’ branch (when ‘pid != 0’)... |...... | 835 | char *buf = NULL; | | ~~~ | | | | | (2) ...to here |...... | 840 | fp = fdopen (p[PREAD], "r"); | | ~~~~~~~~~~~~~~~~~~~~~~ | | | | | (3) this call could return NULL | 841 | rc = getline (&buf, &size, fp); | | ~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (4) argument 3 (‘fp’) from (3) could be NULL where non-null expected | In file included from ../gnu/stdio.h:55, from ../lib/system.h:119, from system.c:18: /usr/include/stdio.h:707:18: note: argument 3 of ‘getline’ must be non-null 707 | extern __ssize_t getline (char **__restrict __lineptr, | ^~~~~~~ Regards, -- Matteo Croce perl -e 'for($t=0;;$t++){print chr($t*($t>>8|$t>>13)&255)}' |aplay