[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #13865 [Tor]: Enable Tor to load Torrc from <stdin> removing the need to write it to filesystem



#13865: Enable Tor to load Torrc from <stdin> removing the need to write it to
filesystem
-----------------------------+---------------------------------------
     Reporter:  naif         |      Owner:
         Type:  enhancement  |     Status:  needs_review
     Priority:  normal       |  Milestone:  Tor: 0.2.6.x-final
    Component:  Tor          |    Version:
   Resolution:               |   Keywords:  tor,txtorconn,torrc lorax
Actual Points:               |  Parent ID:
       Points:               |
-----------------------------+---------------------------------------

Comment (by nickm):

 I agree that tests would be good.  The code looks mostly plausible.  A few
 suggestions:

  * Make read_torrc_from_stdin const.

  * Maybe instead of a trinary `... ? ... : ...` expression, prefer an
 if...else ?  If it's multiline like that it probaby isn't adding to
 clarity.

  * The strncmp... should be a strcmp.  You're checking whether the value
 is exactly -, not whether it starts with -.

  * How about you replace the body of load_torrc_from_stdin with a call to
 `read_file_to_str_until_eof(STDIN_FILENO, (1u<<24), NULL)` ?

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/13865#comment:9>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs