use unique_fd !ok() instead of == -1

while at it add 'const' to satisfy the linter

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I207be20c75b103bc5332c111291e4c439ba82219
1 file changed