[tor-bugs] #21654 [Core Tor/Tor]: Don't use fgets() when we might get EAGAIN

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Mar 7 23:52:16 UTC 2017


#21654: Don't use fgets() when we might get EAGAIN
--------------------------+----------------------------------
 Reporter:  nickm         |          Owner:  ahf
     Type:  defect        |         Status:  needs_review
 Priority:  Medium        |      Milestone:  Tor: unspecified
Component:  Core Tor/Tor  |        Version:
 Severity:  Normal        |     Resolution:
 Keywords:                |  Actual Points:
Parent ID:                |         Points:
 Reviewer:                |        Sponsor:
--------------------------+----------------------------------

Comment (by nickm):

 Hm.  I wonder if we should propagate this switch from FILE to fileno even
 higher in the read_all_handle code.  That is, on anything where we call
 tor_read_all_handle, we shouldn't be using fgets() at all: It's not safe
 to mix buffered IO (like FILE) does and non-buffered IO.

 Alternatively, for an easier alternative, we can try turning off buffering
 on these particular FILEs.  I forget how to do that.  setvbuf?

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/21654#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list