[libvirt] [PATCH 1/3] virfile: Introduce virFileAppendStr

Eric Blake eblake at redhat.com
Mon Jan 27 20:18:20 UTC 2014


On 01/27/2014 07:03 AM, Michal Privoznik wrote:
> So far we only have an API that truncates the file prior to
> writing it.  However, experience show need for new API that just
> appends a string to file.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/libvirt_private.syms |  1 +
>  src/util/virfile.c       | 48 ++++++++++++++++++++++++++++++++++++++++--------
>  src/util/virfile.h       |  2 ++
>  3 files changed, 43 insertions(+), 8 deletions(-)
> 

> +int
> +virFileAppendStr(const char *path, const char *str, mode_t mode)
> +{
> +    return virFileWriteAppendStr(path, str, O_WRONLY | O_APPEND, mode);

See my question in 2/3 on whether this needs an additional parameter to
guarantee that the appended text ends in newline; but overall I like how
it looks.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140127/20df5cdf/attachment-0001.sig>


More information about the libvir-list mailing list