--ControlPortWriteToFile reports port 0 on --ControlPort=auto, not opened port

If I start the latest tor code with --ControlPort=auto and --ControlPortWriteToFile=/path/to/file, then the contents of the file end up as PORT=127.0.0.1:0, which is kind of useless :)

I guess some code got messed up lately that updates the port before writing it out to the control file.

Trac:
Username: karalabe

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information