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:
parent
d6d0a675bf
commit
1657106b0c
1 changed files with 4 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue