
There's no use assigning the output of strtoul() to a 32-bit variable then checking that against ULONG_MAX. Instead use a "unsigned long" as the temporary variable. Also, only check against UID_MAX/GID_MAX; these are both going to be smaller than ULONG_MAX on both 32- and 64-bit platforms.