Le quartidi 4 frimaire, an CCXXV, Kevin Lo a écrit : > FreeBSD's socket calls require the sockaddr struct length to agree > with the address family, Linux does not. This patch fixes a failing > getnameinfo() call on FreeBSD. > > Signed-off-by: Kevin Lo <ke...@kevlo.org>
I looked at the standard, the semantic of salen is not specified. In doubt, I would consider the usage to be invalid even if it works by happenstance on Linux. > --- > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > index c6292c5..15fe25d 100644 > --- a/libavformat/rtsp.c > +++ b/libavformat/rtsp.c > @@ -2310,7 +2310,11 @@ static int sdp_read_header(AVFormatContext *s) > AVDictionary *opts = map_to_opts(rt); > > err = getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, > +#ifdef __FreeBSD__ > + ((struct sockaddr*) &rtsp_st->sdp_ip)->sa_len, > +#else > sizeof(rtsp_st->sdp_ip), > +#endif On the other hand, sa_len is not standard, and littering the code with ifdefry is ugly. Better add a field sdp_ip_len and set it at the same time as sdp_ip. Also, there are other instance of the same misuse of getnameinfo() in this file. > namebuf, sizeof(namebuf), NULL, 0, > NI_NUMERICHOST); > if (err) { > av_log(s, AV_LOG_ERROR, "getnameinfo: %s\n", > gai_strerror(err)); Regards, -- Nicolas George
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel