int main(void) {
struct sigaction sact , sact_old ;
// Definitions for functions handler() and fatal() not shown ; assume
// they have no issues.
if (sigaction(SIGCHLD , 0 , &sact_old) == -1)
fatal("sigaction() call to get the original signal handling failed") ;
sact.sa_mask = sact_old.sa_mask ; // *** Is this OK ? ***
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigemptyset.html :
RATIONALE
The implementation of the sigemptyset() (or sigfillset()) function
could quite trivially clear (or set) all the bits in the signal set.
Alternatively, it would be reasonable to initialize part of the
structure, such as a version field, to permit binary-compatibility
between releases where the size of the set varies. For such reasons,
either sigemptyset() or sigfillset() must be called prior to any
other use of the signal set, even if such use is read-only (for
example, as an argument to sigpending()).
If we take this literally then what my code does above is not ok.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 60:58:32 |
Calls: | 6,654 |
Calls today: | 6 |
Files: | 12,200 |
Messages: | 5,331,524 |