Opened 2 weeks ago

Closed 2 weeks ago

Last modified 2 weeks ago

#28303 closed defect (fixed)

Include sys/time.h in timers.c and time_fmt.c to fix OpenBSD build

Reported by: kjak Owned by:
Priority: Medium Milestone: Tor: 0.3.5.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: openbsd
Cc: Actual Points:
Parent ID: Points:
Reviewer: dgoulet Sponsor:

Description

The files src/lib/encoding/time_fmt.c and src/lib/evloop/timers.c both need to include sys/time.h for struct timeval. Otherwise compilation fails on OpenBSD with the following errors:

  CC       src/lib/encoding/time_fmt.o
  src/lib/encoding/time_fmt.c: In function 'format_iso_time_nospace_usec':
  src/lib/encoding/time_fmt.c:318: error: dereferencing pointer to incomplete type
  src/lib/encoding/time_fmt.c:319: error: dereferencing pointer to incomplete type
  gmake[1]: *** [Makefile:9088: src/lib/encoding/time_fmt.o] Error 1

and

  CC       src/lib/evloop/timers.o
  src/lib/evloop/timers.c: In function 'tv_to_timeout':
  src/lib/evloop/timers.c:115: error: dereferencing pointer to incomplete type
  src/lib/evloop/timers.c:116: error: dereferencing pointer to incomplete type
  src/lib/evloop/timers.c: In function 'timeout_to_tv':
  src/lib/evloop/timers.c:128: error: dereferencing pointer to incomplete type
  src/lib/evloop/timers.c:129: error: dereferencing pointer to incomplete type
  src/lib/evloop/timers.c: In function 'libevent_timer_reschedule':
  src/lib/evloop/timers.c:156: error: storage size of 'd' isn't known
  src/lib/evloop/timers.c:156: warning: unused variable 'd'
  gmake[1]: *** [Makefile:9088: src/lib/evloop/timers.o] Error 1

This change does not appear to be necessary on FreeBSD or NetBSD.

Child Tickets

Change History (7)

comment:2 Changed 2 weeks ago by kjak

Status: newneeds_review

I'm updating the status of this ticket to needs_review since there is a PR to fix the problem. (Please correct me if I'm wrong here.)

comment:3 Changed 2 weeks ago by dgoulet

Reviewer: dgoulet
Status: needs_reviewmerge_ready

lgtm;

comment:4 Changed 2 weeks ago by nickm

Milestone: Tor: 0.3.5.x-final

Is this bug new with 0.3.5, or did 0.3.4 have it too?

comment:5 Changed 2 weeks ago by nickm

Looks like it's new in 0.3.5.

comment:6 Changed 2 weeks ago by nickm

Resolution: fixed
Status: merge_readyclosed

Cherry-picked to maint-0.3.5 and merged forward. Thank you!

comment:7 Changed 2 weeks ago by kjak

Awesome. Thanks!

Note: See TracTickets for help on using tickets.