This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
gdb/2032: GDB introduces odd behavior with accept() function
- From: devin at freeshell dot org
- To: gdb-gnats at sources dot redhat dot com
- Date: 11 Nov 2005 23:30:37 -0000
- Subject: gdb/2032: GDB introduces odd behavior with accept() function
- Reply-to: devin at freeshell dot org
>Number: 2032
>Category: gdb
>Synopsis: GDB introduces odd behavior with accept() function
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Fri Nov 11 23:38:01 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: devin@freeshell.org
>Release: gdb-6.3
>Organization:
>Environment:
libc-2.3.5 linux-2.6.11 gcc-4.0.2
>Description:
When debugging this test program, interupt it during the accept and type "signal SIGHUP". fd becomes -512. Without using gdb, it becomes -1.
#define _XOPEN_SOURCE 600
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <signal.h>
void hangup(int sig) { fprintf(stderr, "SIG=%i\n", sig); }
int main(void)
{
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in addr = {0};
int len = sizeof(addr);
addr.sin_family = AF_INET;
addr.sin_port = htons(9999);
bind(sockfd, &addr, len);
listen(sockfd,5);
signal(SIGHUP, hangup);
int fd;
while(fd = accept(sockfd, &addr, &len))
fprintf(stderr, "FD=%i\n", fd);
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: