csv: time_t and printf()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mtr |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
printf() and time_t:
on NetBSD6/i386 long is 32 bits, time_t is 64 bits.
% uname -srm
NetBSD 6.0.1 i386
% ./mtr -v
mtr 0.84+git:9df5282f
% ./mtr -tC -c1 localhost
zsh: segmentation fault (core dumped) ./mtr -tC -c1 localhost
% gdb mtr
GNU gdb (GDB) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486--netbsdelf".
For bug reporting instructions, please see:
<http://
Reading symbols from /usr/home/
(gdb) set args -tC -c1 localhost
(gdb) run
Starting program: /usr/home/
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 1]
0xbb158daa in __vfprintf_unlocked () from /usr/lib/libc.so.12
(gdb)
(gdb) bt
#0 0xbb158daa in __vfprintf_unlocked () from /usr/lib/libc.so.12
#1 0xbb159eef in vfprintf () from /usr/lib/libc.so.12
#2 0xbb154efa in printf () from /usr/lib/libc.so.12
#3 0x0805539d in csv_close (now=1368624897) at report.c:349
#4 0x0804f460 in main (argc=4, argv=0xbfbfec40) at mtr.c:686
(gdb)
(gdb) list report.c:349,350
349 printf(
350 at+1, name, last);
(gdb)
(gdb) print sizeof(time_t)
$1 = 8
(gdb) print sizeof(long)
$2 = 4
(gdb)
fix:
--- report.c.orig 2013-05-15 13:24:32.000000000 +0300
+++ report.c 2013-05-15 14:36:29.000000000 +0300
@@ -340,15 +340,16 @@
snprint_
int last = net_last(at);
+#ifndef NO_IPINFO
if(!ipinfo_no) {
char* fmtinfo = fmt_ipinfo(addr);
if (fmtinfo != NULL) fmtinfo = trim(fmtinfo);
- printf(
+ printf(
at+1, name, fmtinfo, last);
- } else {
- printf(
+ } else
+#endif
+ printf(
at+1, name, last);
- }
for( i=0; i<MAXFLD; i++ ) {
j = fld_index[
Changed in mtr: | |
status: | New → Fix Committed |
Changed in mtr: | |
status: | Fix Committed → Fix Released |
commits:
report.c@57f2d65 "fix for NetBSD: 64bit time_t -- Thomas Klausner"
report.c@25a2456 "glib dependency fixes."
report.c@92f3c2a "added typo fix."