a line that turned out to be incredibly polarising amongst code reviewers.
Explanation for those not well versed in C: the ternary in the left-hand parentheses is selecting which syscall wrapper function will be dereferenced and called with the arguments in the right-hand parentheses. It relies on the chown(2) and lchown(2) syscall wrappers having identical function signatures.
Re:Gosh Darn Function Pointers
by edcarter on Monday January 15, 2018 @05:34PM
(#16154068)
That is fancy, but not very readable. I would have been on the side of the code review which would favor readability over conciseness. Cool trick though.
Explanation for those not well versed in C: the ternary in the left-hand parentheses is selecting which syscall wrapper function will be dereferenced and called with the arguments in the right-hand parentheses. It relies on the chown(2) and lchown(2) syscall wrappers having identical function signatures.