
The ucred_t argument must be initialized to zero otherwise it is assumed to point to allocated memory. Also, the logic is inverted: getpeerucred() returns zero on success, not failure.
The ucred_t argument must be initialized to zero otherwise it is assumed to point to allocated memory. Also, the logic is inverted: getpeerucred() returns zero on success, not failure.