test: yaml-parser: Use write() instead of fwrite()

There's no point in wrapping a fd into a FILE to then only call fwrite()
and fclose(). Use write() and close() directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
This commit is contained in:
Laurent Pinchart 2022-05-24 18:23:17 +03:00
parent d6d0a675bf
commit 1657106b0c

View file

@ -49,10 +49,11 @@ protected:
if (fd == -1) if (fd == -1)
return false; return false;
FILE *fh = fdopen(fd, "w"); int ret = write(fd, content.c_str(), content.size());
fputs(content.c_str(), fh); close(fd);
fclose(fh); if (ret != static_cast<int>(content.size()))
return false;
return true; return true;
} }