[PATCH] tools: Use '-' to read from stdin instead of file

Jason A. Donenfeld Jason at zx2c4.com
Mon Dec 11 22:18:39 CET 2017


On Mon, Dec 11, 2017 at 8:49 PM, Daniel Kahn Gillmor
<dkg at fifthhorseman.net> wrote:
> I'm not sure why it's important to avoid closing stdin when you don't
> plan on reading from it any more, though.  Isn't it more parsimonious to
> go ahead and explicitly close it so that anything writing additional
> data to stdin will get an error?

You could theoretically have a line like this:

{ echo private....;echo public...;} |
wg set wg0 private-key - peer ABCD= preshared-key -

in which case I guess you might not want to close stdin. However the
eof loop here prevents that from actually working:
https://git.zx2c4.com/WireGuard/tree/src/tools/config.c#n147

In light of multiple things potentially being from stdin, maybe - only
makes sense in the context of setconf, but not set? Not sure one way
or another.


More information about the WireGuard mailing list