News for hackers. Stuff that matters.
Re:Comparative unsafety by NovemberWhiskey on Friday April 09, 2021 @07:19PM (#26757373)
If you read the POSIX specification for chown you'll see that the "leave unchanged" sentinel value is, for UIDs, defined to be (uid_t) -1.

I can't be bothered to try it myself but I'm fairly sure the author could just have written (-1i32) as uid_t and gotten some of their life back.

Re:Comparative unsafety by cryptonector on Friday April 09, 2021 @11:45PM (#26758743)
Yes. Specifically, POSIX does not specify whether id_t, uid_t, gid_t, or pid_t are signed or unsigned, so whenever it refers to the "default"/"leave alone"/"unspecified" value, it always does it as a cast of -1.