vapier / ncompress

a fast, simple LZW file compressor
https://vapier.github.io/ncompress/
The Unlicense
104 stars 18 forks source link

compress42.c:707]: (style) Suspicious condition #8

Closed dcb314 closed 8 years ago

dcb314 commented 8 years ago

Source code is

 if ((fgnd_flag = (signal(SIGINT, SIG_IGN)) != SIG_IGN))

Maybe better code

if ((fgnd_flag = signal(SIGINT, SIG_IGN)) != SIG_IGN)
vapier commented 8 years ago

i agree the code isn't exactly clear, or perhaps that common in current style practices, but the code as-written is correct. fgnd_flag is a flag variable and is described earlier:

int             fgnd_flag = 0;      /* Running in background (SIGINT=SIGIGN)        */

it is not holding the previous signal disposition.