Date: Wed, 28 Jul 2010 08:21:39 GMT From: Sergio Ligregni <ligregni@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 181487 for review Message-ID: <201007280821.o6S8LdVY009250@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@181487?ac=10 Change 181487 by ligregni@ligPhenom on 2010/07/28 02:28:35 Some specs about managing files Affected files ... .. //depot/projects/soc2010/disaudit/msocket_work.c#7 edit .. //depot/projects/soc2010/disaudit/msocket_work.h#8 add .. //depot/projects/soc2010/disaudit/ssocket_work.h#9 add Differences ... ==== //depot/projects/soc2010/disaudit/msocket_work.c#7 (text+ko) ==== @@ -43,35 +43,31 @@ /*** DECLARATIONS ***/ /* local prototypes */ -int init_socket(int); -int accept_connection(int, struct sockaddr *); +int init_socket(int); +int accept_connection(int, struct sockaddr *); int init_socket(int port) { struct sockaddr_in sockaddr; - int sockfd; + int sockfd; sockfd = socket(PF_INET, SOCK_STREAM, 0); - if (sockfd < 0) - { + if (sockfd < 0) { to_log("Cannot create socket!"); return (-1); } - bzero(&sockaddr, sizeof(sockaddr)); sockaddr.sin_family = AF_INET; sockaddr.sin_addr.s_addr = htonl(INADDR_ANY); sockaddr.sin_port = htons(port); - if (bind(sockfd, (struct sockaddr *) &sockaddr, sizeof(sockaddr)) < 0) - { + if (bind(sockfd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) { to_log("Cannot bind to port"); return (-1); } - listen(sockfd, 500); return (sockfd); @@ -81,14 +77,14 @@ accept_connection(int sfd, struct sockaddr *clientinfo) { struct sockaddr_in clientaddr; - socklen_t clientlen = sizeof(clientaddr); - int retval = 0; + socklen_t clientlen = sizeof(clientaddr); + int retval = 0; - retval = accept(sfd, (struct sockaddr *) &clientaddr, &clientlen); + retval = accept(sfd, (struct sockaddr *)&clientaddr, &clientlen); if (retval >= 0) memcpy(clientinfo, &clientaddr, sizeof(struct sockaddr)); - return (retval); + return (retval); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007280821.o6S8LdVY009250>