Hacker News new | ask | show | jobs
by kijin 2754 days ago
Was the special treatment of -1 intended by the developers, or did somebody mix up signed -1 with unsigned 65535?
3 comments

In POSIX, many functions return -1 to indicate errors. So I guess the value (uid_t) -1 was reserved to avoid confusion. Also some functions (chown()) allow specifying (uid_t) -1 or (gid_) -1 to mark an omitted argument.

See https://en.wikipedia.org/wiki/User_identifier#Special_values

See above - it was -2 or 65534.

I think -2 is just easier to type and stands out more.