com_err(whoami,errno," socket");
exit(1);
}
- bzero((char *)&sin,(int)sizeof(sin));
+ memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = sp->s_port;
sin.sin_addr.s_addr = INADDR_ANY;
/* Bind a name to the socket */
- if (bind(s, &sin, sizeof(sin)) < 0)
+ if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0)
{
com_err(whoami,errno," bind");
exit(1);
#endif
status = TRUE;
(void) sendto(s, requests[i].out_pkt, requests[i].out_pktlen,
- 0, &sin, addrlen);
+ 0, (struct sockaddr *)&sin, addrlen);
break;
}
}
if (format_pkt(CUR_REQ.out_pkt, &(CUR_REQ.out_pktlen),
CUR_REQ.seqno, status, text))
com_err(whoami,0,"Client error message was truncated.");
- (void) sendto(s, CUR_REQ.out_pkt, CUR_REQ.out_pktlen, 0, &sin, addrlen);
+ (void) sendto(s, CUR_REQ.out_pkt, CUR_REQ.out_pktlen, 0,
+ (struct sockaddr *)&sin, addrlen);
cur_request_index = NEXT_INDEX(cur_request_index);
}
com_err(whoami, 0, "*** Ready for next request ***");
addrlen = sizeof(sin);
/* Receive a packet */
- if ((pktlen = recvfrom(s,packet,sizeof(packet),0,&sin,&addrlen)) < 0)
+ if ((pktlen = recvfrom(s,packet,sizeof(packet),0,
+ (struct sockaddr *)&sin,&addrlen)) < 0)
{
com_err(whoami, errno, " recvfrom");
/* Don't worry if error is interrupted system call. */
U_32BIT vers = htonl((U_32BIT)CUR_UREG_VERSION);
cl_status = htonl((U_32BIT)cl_status);
/* Put current user registration protocol version into the packet */
- bcopy((char *)&vers, packet, sizeof(U_32BIT));
+ memcpy(packet, &vers, sizeof(U_32BIT));
/* Put sequence number into the packet */
- bcopy((char *)&seqno, packet+sizeof(U_32BIT), sizeof(U_32BIT));
+ memcpy(packet+sizeof(U_32BIT), &seqno, sizeof(U_32BIT));
/* Put error status into the packet */
- bcopy((char *)&cl_status, packet+ 2*sizeof(U_32BIT), sizeof(U_32BIT));
+ memcpy(packet+ 2*sizeof(U_32BIT), &cl_status, sizeof(U_32BIT));
/* Find out how much of the message to copy; truncate if too short. */
/* How much room is there left? */
{
status = FAILURE; /* Message was truncated */
/* Truncate the message */
- message[len-1] = NULL;
+ message[len-1] = '\0';
}
/* Copy the message into the packet */
if (status == SUCCESS)
{
/* Extract the user registration protocol version from the packet */
- bcopy(packet, (char *)&message->version, sizeof(long));
+ memcpy(&message->version, packet, sizeof(long));
/* Convert byte order from network to host */
message->version = ntohl(message->version);
/* Verify version */
if (status == SUCCESS)
{
/* Extract the sequence number from the packet */
- bcopy(packet, (char *)&CUR_REQ.seqno, sizeof(long));
+ memcpy(&CUR_REQ.seqno, packet, sizeof(long));
packet += sizeof(U_32BIT);
pktlen -= sizeof(U_32BIT);
if (status == SUCCESS)
{
/* Extract the request from the packet */
- bcopy(packet, (char *)(&message->request), sizeof(U_32BIT));
+ memcpy(&message->request, packet, sizeof(U_32BIT));
message->request = ntohl(message->request);
packet += sizeof(U_32BIT);
pktlen -= sizeof(U_32BIT);