[RFC REPOST 3/7] virCgroupSetFCAppid: properly handle when appid is NULL

Pavel Hrdina phrdina at redhat.com
Fri Sep 10 13:16:40 UTC 2021


On Fri, Sep 10, 2021 at 01:49:22PM +0200, Michal Prívozník wrote:
> On 9/9/21 6:13 PM, Pavel Hrdina wrote:
> > With introduction of live changes of appid we should also support
> > removal of the appid from VM. This is done by writing empty appid part
> > to appid_store file.
> > 
> > Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> > ---
> >  src/util/vircgroup.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
> > index ad0ee20862..9470ab061d 100644
> > --- a/src/util/vircgroup.c
> > +++ b/src/util/vircgroup.c
> > @@ -4026,7 +4026,7 @@ virCgroupSetFCAppid(virCgroup *group,
> >      if (inode < 0)
> >          return -1;
> >  
> > -    vmid = g_strdup_printf("%X:%s", inode, appid);
> > +    vmid = g_strdup_printf("%X:%s", inode, appid ? appid : "");
> 
> Or NULLSTR_EMPTY(appid) instead of ternary operator.

Nice :) didn't know we have a helper for that.

Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210910/18453c42/attachment-0001.sig>


More information about the libvir-list mailing list