+/*
+ * CDE - Common Desktop Environment
+ *
+ * Copyright (c) 1993-2012, The Open Group. All rights reserved.
+ *
+ * These libraries and programs are free software; you can
+ * redistribute them and/or modify them under the terms of the GNU
+ * Lesser General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * These libraries and programs are distributed in the hope that
+ * they will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with these libraries and programs; if not, write
+ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301 USA
+ */
/* $XConsortium: spc-net.c /main/9 1996/11/21 19:53:44 drk $
* File: spc-net.c
* Language: C
*/
/*----------------------------------------------------------------------+*/
+int
SPC_Local_Hostname(XeString hostname)
/*----------------------------------------------------------------------+*/
{
}
/*----------------------------------------------------------------------+*/
+int
SPC_Open_Socket(SPC_Connection_Ptr conn,
int type)
/*----------------------------------------------------------------------+*/
struct servent *service;
- conn->sid=socket(type, SOCK_STREAM, NULL);
+ conn->sid=socket(type, SOCK_STREAM, 0);
if(conn->sid == ERROR) {
SPC_Error(SPC_Bad_Socket);
return(SPC_ERROR);
*/
/*----------------------------------------------------------------------+*/
+int
SPC_Contact_Server(SPC_Connection_Ptr connection)
/*----------------------------------------------------------------------+*/
{
memcpy(&saddr.sin_addr, remote->h_addr, remote->h_length);
if(connect(connection->sid, (struct sockaddr *)&saddr, sizeof(saddr)) == ERROR) {
- SPC_Error(SPC_Bad_Connect,
- XeFindShortHost(remote->h_name));
+ XeString shorthost = XeFindShortHost(remote->h_name);
+ SPC_Error(SPC_Bad_Connect, shorthost);
+ XeFree(shorthost);
+
return(SPC_ERROR);
}
SPC_Connection_Ptr SPC_Standalone_Daemon(SPC_Connection_Ptr conn)
{
struct sockaddr_in saddr, client_saddr;
-#ifdef USL
- /* Only UnixWare 2.02 uses the Spec1170 parameter profile for accept(). */
- size_t len=sizeof(client_saddr);
-#else
int len=sizeof(client_saddr);
-#endif
int server_bind_attempts = MAX_SERVER_BIND_ATTEMPTS;
int server_bind_pause = SERVER_PAUSE_INTERVAL;
int pid, from;
#if defined(__aix)
if (setsockopt(conn->sid, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))==ERROR) {
#else
- if (setsockopt(conn->sid, SOL_SOCKET, SO_REUSEADDR, NULL, NULL)==ERROR) {
+ if (setsockopt(conn->sid, SOL_SOCKET, SO_REUSEADDR, NULL, 0)==ERROR) {
#endif
SPC_Error(SPC_Bad_Reuse);
return(SPC_ERROR);
}
/*----------------------------------------------------------------------+*/
+int
SPC_Inetd_Daemon(SPC_Connection_Ptr conn)
/*----------------------------------------------------------------------+*/
{