[FFmpeg-devel] [PATCH] ffmpeg: check value of write syscall

Nicolas George george at nsup.org
Sat Jul 25 16:31:16 CEST 2015


Le septidi 7 thermidor, an CCXXIII, Ganesh Ajjanagadde a écrit :
> >> -        write(2/*STDERR_FILENO*/, "Received > 3 system signals, hard exiting\n",
> >> +        num_write = write(2/*STDERR_FILENO*/, "Received > 3 system signals, hard exiting\n",
> >>                             strlen("Received > 3 system signals, hard exiting\n"));
> >> -
> >> +        if(num_write < 0)
> >> +            perror("write");

> Ok. How about making this errno set by write (if any) become part of
> the exit code, e.g by or'ing?
> As it stands, the 123 in the exit status sounds quite arbitrary, so
> this should be ok,
> and gives the parent a chance to distinguish between the two cases.

IMHO, you are wasting your time here: this error message is not important,
it is only for people who did not notice they had the elbow on the Ctrl key
while their cat was pawing the C key.

More seriously: this message is for informing human users that the reason
for stopping is three signals. The 123 return code is for informing the
parent process of the same condition. They are entirely redundant
(especially with a good shell that has an option to print the error code of
a failed command), and the exit code can not fail. Therefore, we really do
not care if writing the error message fails.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150725/7aaeccce/attachment.sig>


More information about the ffmpeg-devel mailing list