<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Cyril, Petr, Xu,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 22, 2021 at 6:39 PM Cyril Hrubis <<a href="mailto:chrubis@suse.cz" target="_blank">chrubis@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi!<br>
> We use just FILE_PRINTF(), but we check the result and TWARN, which causes the<br>
> failure in CI.<br>
<br>
Which is why I argued that we should add a version that does not print<br>
anything and just returns if the operation was successful or not. I<br>
guess it could be called TRY_FILE_PRINTF() or something.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">or SILENT_FILE_PRINTF()?</div></div><div class="gmail_default" style="font-size:small"><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> I've sent v2, which checks CAP_SYS_ADMIN and CAP_SYS_RESOURCE,<br>
> but feel free just to bring simpler solution.<br>
<br>
I still think that the most acurate test would be just writing to the<br>
file and checking the result.<br></blockquote><div><br></div><span class="gmail_default" style="font-size:small">Yes</span>, <span class="gmail_default" style="font-size:small">this method is simpler. </span></div><div class="gmail_quote"><br></div><div class="gmail_quote"><span class="gmail_default" style="font-size:small">But</span> checking the CAP_SYS_RESOURCE cap<span class="gmail_default" style="font-size:small"> can show </span>the </div><div class="gmail_quote"><span class="gmail_default" style="font-size:small">original problem</span> more clearly, people read code easily to know</div><div class="gmail_quote">why <span class="gmail_default" style="font-size:small">here </span>we <span class="gmail_default" style="font-size:small">do</span> that <span class="gmail_default" style="font-size:small">cap </span>check. </div><div class="gmail_quote"><div class="gmail_default" style="font-size:small">(e.g. like me cost much time debugging but not know the root cause)</div></div><div class="gmail_quote"><div><br></div><div><div class="gmail_default" style="font-size:small">So I think both of your solutions are great. Can we add the</div><div class="gmail_default" style="font-size:small">silent file_printf into lib? I think it is useful to LTP as well. </div></div><div> </div></div>-- <br><div dir="ltr"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>