From 1657106b0cf34ba3afded560937956b1ee1205ce Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 24 May 2022 18:23:17 +0300 Subject: 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 Reviewed-by: Paul Elder --- test/yaml-parser.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp index e75f8fe8..5ff4c323 100644 --- a/test/yaml-parser.cpp +++ b/test/yaml-parser.cpp @@ -49,10 +49,11 @@ protected: if (fd == -1) return false; - FILE *fh = fdopen(fd, "w"); - fputs(content.c_str(), fh); + int ret = write(fd, content.c_str(), content.size()); + close(fd); - fclose(fh); + if (ret != static_cast(content.size())) + return false; return true; } -- cgit v1.2.1