Make sure we never pass a negative value to dup2(...)

This commit is contained in:
practicalswift 2018-03-19 09:21:45 +01:00 committed by Rusty Russell
parent 148aaa79d5
commit e56eee50c8

View file

@ -30,6 +30,7 @@
static bool move_fd(int from, int to) static bool move_fd(int from, int to)
{ {
assert(from >= 0);
if (dup2(from, to) == -1) if (dup2(from, to) == -1)
return false; return false;
close(from); close(from);