From owner-p4-projects@FreeBSD.ORG Wed Jul 28 08:21:56 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7E2E610669FF; Wed, 28 Jul 2010 08:21:42 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30A8C1065F1B for ; Wed, 28 Jul 2010 08:21:41 +0000 (UTC) (envelope-from ligregni@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 405198FC15 for ; Wed, 28 Jul 2010 08:21:39 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.4/8.14.4) with ESMTP id o6S8Ldjt009252 for ; Wed, 28 Jul 2010 08:21:39 GMT (envelope-from ligregni@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.4/8.14.4/Submit) id o6S8LdVY009250 for perforce@freebsd.org; Wed, 28 Jul 2010 08:21:39 GMT (envelope-from ligregni@FreeBSD.org) Date: Wed, 28 Jul 2010 08:21:39 GMT Message-Id: <201007280821.o6S8LdVY009250@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to ligregni@FreeBSD.org using -f From: Sergio Ligregni To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 181487 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jul 2010 08:21:56 -0000 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); }