As described by the submitter:
... fix a bug with orecvfrom() or recvfrom() called with the MSG_COMPAT flag on kernels compiled with the COMPAT_43 option. The symptom is that the fromaddr is not correctly returned. This affects the Linux emulator. Submitted by: pb@fasterix.freenix.org (Pierre Beyssac)
This commit is contained in:
parent
8256655132
commit
5af7db2b73
|
@ -31,7 +31,7 @@
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94
|
* @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94
|
||||||
* $Id: uipc_syscalls.c,v 1.31 1997/10/12 20:24:17 phk Exp $
|
* $Id: uipc_syscalls.c,v 1.32 1997/11/06 19:29:26 phk Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "opt_ktrace.h"
|
#include "opt_ktrace.h"
|
||||||
|
@ -700,15 +700,16 @@ recvit(p, s, mp, namelenp)
|
||||||
if (len <= 0 || fromsa == 0)
|
if (len <= 0 || fromsa == 0)
|
||||||
len = 0;
|
len = 0;
|
||||||
else {
|
else {
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(a,b) ((a)>(b)?(b):(a))
|
||||||
|
#endif
|
||||||
|
/* save sa_len before it is destroyed by MSG_COMPAT */
|
||||||
|
len = MIN(len, fromsa->sa_len);
|
||||||
#ifdef COMPAT_OLDSOCK
|
#ifdef COMPAT_OLDSOCK
|
||||||
if (mp->msg_flags & MSG_COMPAT)
|
if (mp->msg_flags & MSG_COMPAT)
|
||||||
((struct osockaddr *)fromsa)->sa_family =
|
((struct osockaddr *)fromsa)->sa_family =
|
||||||
fromsa->sa_family;
|
fromsa->sa_family;
|
||||||
#endif
|
#endif
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(a,b) ((a)>(b)?(b):(a))
|
|
||||||
#endif
|
|
||||||
len = MIN(len, fromsa->sa_len);
|
|
||||||
error = copyout(fromsa,
|
error = copyout(fromsa,
|
||||||
(caddr_t)mp->msg_name, (unsigned)len);
|
(caddr_t)mp->msg_name, (unsigned)len);
|
||||||
if (error)
|
if (error)
|
||||||
|
|
Loading…
Reference in New Issue