* Throughout, replace usage of w32api's min with MIN from sys/param.h.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* fhandler_socket.cc. See fhandler.h for a description of the fhandler classes.
|
||||
|
||||
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
||||
2009, 2010, 2011 Red Hat, Inc.
|
||||
2009, 2010, 2011, 2012 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "sigproc.h"
|
||||
#include "wininfo.h"
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/acl.h>
|
||||
#include "cygtls.h"
|
||||
#include "cygwin/in6.h"
|
||||
@@ -1213,12 +1214,12 @@ fhandler_socket::accept4 (struct sockaddr *peer, int *len, int flags)
|
||||
bound socket name of the peer's socket. For now
|
||||
we just fake an unbound socket on the other side. */
|
||||
static struct sockaddr_un un = { AF_LOCAL, "" };
|
||||
memcpy (peer, &un, min (*len, (int) sizeof (un.sun_family)));
|
||||
memcpy (peer, &un, MIN (*len, (int) sizeof (un.sun_family)));
|
||||
*len = (int) sizeof (un.sun_family);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy (peer, &lpeer, min (*len, llen));
|
||||
memcpy (peer, &lpeer, MIN (*len, llen));
|
||||
*len = llen;
|
||||
}
|
||||
}
|
||||
@@ -1247,7 +1248,7 @@ fhandler_socket::getsockname (struct sockaddr *name, int *namelen)
|
||||
sun.sun_path[0] = '\0';
|
||||
if (get_sun_path ())
|
||||
strncat (sun.sun_path, get_sun_path (), UNIX_PATH_LEN - 1);
|
||||
memcpy (name, &sun, min (*namelen, (int) SUN_LEN (&sun) + 1));
|
||||
memcpy (name, &sun, MIN (*namelen, (int) SUN_LEN (&sun) + 1));
|
||||
*namelen = (int) SUN_LEN (&sun) + (get_sun_path () ? 1 : 0);
|
||||
res = 0;
|
||||
}
|
||||
@@ -1261,7 +1262,7 @@ fhandler_socket::getsockname (struct sockaddr *name, int *namelen)
|
||||
res = ::getsockname (get_socket (), (struct sockaddr *) &sock, &len);
|
||||
if (!res)
|
||||
{
|
||||
memcpy (name, &sock, min (*namelen, len));
|
||||
memcpy (name, &sock, MIN (*namelen, len));
|
||||
*namelen = len;
|
||||
}
|
||||
else
|
||||
@@ -1290,7 +1291,7 @@ fhandler_socket::getsockname (struct sockaddr *name, int *namelen)
|
||||
}
|
||||
if (!res)
|
||||
{
|
||||
memcpy (name, &sock, min (*namelen, len));
|
||||
memcpy (name, &sock, MIN (*namelen, len));
|
||||
*namelen = len;
|
||||
}
|
||||
}
|
||||
@@ -1321,12 +1322,12 @@ fhandler_socket::getpeername (struct sockaddr *name, int *namelen)
|
||||
sun.sun_path[0] = '\0';
|
||||
if (get_peer_sun_path ())
|
||||
strncat (sun.sun_path, get_peer_sun_path (), UNIX_PATH_LEN - 1);
|
||||
memcpy (name, &sun, min (*namelen, (int) SUN_LEN (&sun) + 1));
|
||||
memcpy (name, &sun, MIN (*namelen, (int) SUN_LEN (&sun) + 1));
|
||||
*namelen = (int) SUN_LEN (&sun) + (get_peer_sun_path () ? 1 : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy (name, &sock, min (*namelen, len));
|
||||
memcpy (name, &sock, MIN (*namelen, len));
|
||||
*namelen = len;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user