Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No output on interrupting a --report with ^C #4

Open
cnst opened this issue Apr 6, 2013 · 1 comment
Open

No output on interrupting a --report with ^C #4

cnst opened this issue Apr 6, 2013 · 1 comment

Comments

@cnst
Copy link

cnst commented Apr 6, 2013

When you're doing a long run with --report, and decide to interrupt the process with ^C, it would be nice if mtr would dump the output as it has, instead of simply quitting and abandoning the whole run.

@rewolff
Copy link
Collaborator

rewolff commented Jul 18, 2013

I agree. Patch welcome.

yvs2014 added a commit to yvs2014/mtr085 that referenced this issue Jun 14, 2014
Looks like the same issue at the bottom of this report:
traviscross#28

 % uname -a; ./mtr -rT localhost; echo $?
 Start: Thu Jun 12 17:09:11 2014
 SunOS opensolaris 5.11 oi_151a9 i86pc i386 i86pc
 141

 % uname -srm; ./mtr -4rT localhost; echo $?
 NetBSD 6.1.3_PATCH i386
 Start: Thu Jun 12 16:14:47 2014
 141

 % gdb ./mtr
 (gdb) set args -4rT localhost
 (gdb) r
 Start: Thu Jun 12 16:15:36 2014
 Program received signal SIGPIPE, Broken pipe.
 [Switching to LWP 1]
 0xbb767387 in write () from /usr/lib/libc.so.12

 (gdb) bt
 #0  0xbb767387 in write () from /usr/lib/libc.so.12
 traviscross#1  0xbb470263 in write () from /usr/lib/libpthread.so.1
 traviscross#2  0x0804fea6 in net_process_fds (writefd=0xbfbfeaac) at net.c:1542
 traviscross#3  0x080544a7 in select_loop () at select.c:264
 traviscross#4  0x0804d5ee in main (argc=3, argv=0xbfbfec58) at mtr.c:719

 (gdb) list net.c:1541,1543
 1541        if (fd > 0 && FD_ISSET(fd, writefd)) {
 1542          r = write(fd, "G", 1);
 1543          /* if write was successful, or connection refused we have
 (gdb)

fix:
 If the socket is connected, getpeername() will return 0.
 Else getpeername() will return ENOTCONN, and read(,,1) will produce the right errno.
 This is a combination of suggestions from Douglas C. Schmidt and Ken Keys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants