[FFmpeg-devel] [patch] error codes for http/tcp
Michael Niedermayer
michaelni
Sat Jun 23 13:23:47 CEST 2007
Hi
On Fri, Jun 22, 2007 at 08:18:46AM -0400, Ronald S. Bultje wrote:
> Hi,
>
> On 6/22/07, Michael Niedermayer <michaelni at gmx.at> wrote:
> >
> >On Thu, Jun 21, 2007 at 11:45:44PM -0400, Ronald S. Bultje wrote:
> >> attached patch improves error code returns from http/tcp code, such that
> >> applications receiving such errors can display actually useful errors to
> >the
> >> user rather than "-1". Don't know how to do HOSTUNREACH, so I made that
> >> ENODEV with an exception for that errno in my code, but I guess that's
> >not
> >> ideal here...
> >
> >the patch should be split in tcp and http parts
>
>
>
> See attached.
[...]
> Index: ffmpeg-mpe/libavformat/tcp.c
> ===================================================================
> --- ffmpeg-mpe.orig/libavformat/tcp.c 2007-03-22 21:28:04.000000000 -0400
> +++ ffmpeg-mpe/libavformat/tcp.c 2007-03-22 21:29:17.000000000 -0400
> @@ -65,17 +65,26 @@
> return AVERROR(ENOMEM);
> h->priv_data = s;
>
> - if (port <= 0 || port >= 65536)
> + if (port <= 0 || port >= 65536) {
> + ret = AVERROR(EINVAL);
> goto fail;
> + }
>
> dest_addr.sin_family = AF_INET;
> dest_addr.sin_port = htons(port);
> - if (resolve_host(&dest_addr.sin_addr, hostname) < 0)
> - goto fail;
> -
> + if (resolve_host(&dest_addr.sin_addr, hostname) < 0) {
> + switch (h_errno) {
this is not thread safe (resolve_host() is implemented by gethostbyname()
which is thread unsafe and the tread safe gethostbyname_r() does not set
h_errno)
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070623/f401b565/attachment.pgp>
More information about the ffmpeg-devel
mailing list