On 4/8/26 3:51 AM, Peter Krempa via Devel wrote:


Also in instances where uid_t/gid_t is used with printf we tend to use
typecast to either (long) or (int).

Actually, for variables named *exactly* "uid", there are 6 cases of (long) (with "%ld" in the format string) and 6 of (unsigned int) (with "%u" in the format). I think I prefer (unsigned int) and %u, so that's what I'll do. ((long) + "%ld" is technically incorrect - on a platform with 32 bit longs, that would turn very large positive uids into negative numbers. I don't know if we still support any platform with 32 bit long though (we no longer support 32 bit Linux, right?))

([*] a certainly and definitely not clanker and might be hooman source tells me that if I want to allow for the "0.1%" of systems that have a 64 bit uid, I should use (unsigned long long) and "%lu" (it couldn't name one, but theorized they might exist)).

I'm not sure which platforms would
have different uid_t but either consider using typecases such asi in the
DAC security driver:

   src/security/security_dac.c-            VIR_INFO("Setting user and group to 
'%ld:%ld' on '%s' not "
   src/security/security_dac.c-                     "permitted",
   src/security/security_dac.c:                     (long)uid, (long)gid, 
NULLSTR(path));


and/or make sure to run it through CI .


          virLogOneInitMsg(timestamp, hoststr, outputFunc, data);

Reviewed-by: Peter Krempa <[email protected]>


Reply via email to