[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 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

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]