diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-05-24 18:23:17 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-06-16 02:43:47 +0300 |
commit | 1657106b0cf34ba3afded560937956b1ee1205ce (patch) | |
tree | 6cde2e66b74b1fb449ba876caf44796897f15363 /test/yaml-parser.cpp | |
parent | d6d0a675bfe27420d14394ef6b0da5247ea63d87 (diff) |
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>
Diffstat (limited to 'test/yaml-parser.cpp')
-rw-r--r-- | test/yaml-parser.cpp | 7 |
1 files 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<int>(content.size())) + return false; return true; } |