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

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

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]