git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Fix gcc-4 warning in accept() call

From
Horst von Brand <vonbrand@inf.utfsm.cl>
Date
Sep 29, 2005, 23:11 UTC
Message-ID
<200509292311.j8TNBZDm022135@inti.inf.utfsm.cl>
In-Reply-To
<proski@gnu.org>
Pavel Roskin <proski@gnu.org> wrote:
Show 18 quoted lines
> Fix gcc-4 warning in accept() call
> 
> gcc-4 warns about sign mismatch in pointers.  Third argument in accept()
> is socklen_t, which is unsigned.  Since Linus doesn't like socklen_t
> (see commit 7fa090844f7d1624c7d1ffc621aae6aec84a1110), let's use
> unsigned int.
> 
> Signed-off-by: Pavel Roskin <proski@gnu.org>
> 
> diff --git a/daemon.c b/daemon.c
> --- a/daemon.c
> +++ b/daemon.c
> @@ -459,7 +459,7 @@ static int serve(int port)
>  
>  			if (FD_ISSET(sockfd, &fds)) {
>  				struct sockaddr_storage ss;
> -				int sslen = sizeof(ss);
> +				unsigned int sslen = sizeof(ss);
Shouldn't this be size_t?
>  				int incoming = accept(sockfd, (struct sockaddr *)&ss, &sslen);
>  				if (incoming < 0) {
>  					switch (errno) {
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513
Next: Pavel Roskin
Message 1 of 3 in “Re: [PATCH] Fix gcc-4 warning in accept() call”
  1. Horst von BrandSep 29, 2005
  2. Pavel RoskinSep 30, 2005
  3. H. Peter AnvinSep 30, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.