Page MenuHome GnuPG

signal.c: ignoring write failures in signal handler, continuing as if everything is OK.
Closed, ResolvedPublic

Description

This one was reported because its not clear to me why its being cast to (void).
The best I can tell, its programmer expediency. If the first write fails, why is
it believed the second, third or fourth will succeed?

Also, this is occurring in a signal handler, so it seems like there's a
potential to make a bad problem worse.


/usr/local/bin/scan-build/ccc-analyzer -DHAVE_CONFIG_H -I. -I.. -I../gl
-I../intl -DLOCALEDIR=\"/home/jwalton/gpg-analyze/share/locale\"
-DGNUPG_BINDIR="\"/home/jwalton/gpg-analyze/bin\""
-DGNUPG_LIBEXECDIR="\"/home/jwalton/gpg-analyze/libexec\""
-DGNUPG_LIBDIR="\"/home/jwalton/gpg-analyze/lib/gnupg\""
-DGNUPG_DATADIR="\"/home/jwalton/gpg-analyze/share/gnupg\""
-DGNUPG_SYSCONFDIR="\"/home/jwalton/gpg-analyze/etc/gnupg\""
-DGNUPG_LOCALSTATEDIR="\"/home/jwalton/gpg-analyze/var\""
-I/home/jwalton/gpg-analyze/include -I/usr/local/include
-I/home/jwalton/gpg-analyze/include -I/home/jwalton/gpg-analyze/include
-I/home/jwalton/gpg-analyze/include -DWITHOUT_NPTH=1 -g3 -O1 -Wall
-Wno-pointer-sign -Wpointer-arith -MT libcommon_a-signal.o -MD -MP -MF
.deps/libcommon_a-signal.Tpo -c -o libcommon_a-signal.o `test -f 'signal.c' ||
echo './'`signal.c

signal.c: In function ‘got_fatal_signal’:
signal.c:111:3: warning: ignoring return value of ‘write’, declared with
attribute warn_unused_result [-Wunused-result]

(void)write (2, "\n", 1 );
^

signal.c:114:5: warning: ignoring return value of ‘write’, declared with
attribute warn_unused_result [-Wunused-result]

(void)write(2, s, strlen (s));
^

signal.c:115:3: warning: ignoring return value of ‘write’, declared with
attribute warn_unused_result [-Wunused-result]

(void)write (2, ": signal ", 9 );
^

signal.c:118:5: warning: ignoring return value of ‘write’, declared with
attribute warn_unused_result [-Wunused-result]

(void) write (2, s, strlen(s) );
^

signal.c:128:9: warning: ignoring return value of ‘write’, declared with
attribute warn_unused_result [-Wunused-result]

(void)write (2, "?", 1);
^

signal.c:137:19: warning: ignoring return value of ‘write’, declared with
attribute warn_unused_result [-Wunused-result]

(void)write (2, "0123456789"+(value/i), 1);
^

signal.c:145:3: warning: ignoring return value of ‘write’, declared with
attribute warn_unused_result [-Wunused-result]

(void)write (2, " caught ... exiting\n", 20);
^

Details

Version
2.1.2

Event Timeline

JW added projects: gnupg, Bug Report.
JW added a subscriber: JW.

Plesase discuss on gnupg-devel. Thanks.

werner claimed this task.