Collin Funk <collin.fu...@gmail.com> writes:

> The implementation shall support one or more programming environments in
> which the widths of blksize_t, pid_t, size_t, ssize_t, and suseconds_t
> are no greater than the width of type long.

Oops, I only quoted the part mentioning pid_t. Two other important
parts:

* nlink_t, uid_t, gid_t, and id_t shall be integer types.
* blksize_t, pid_t, and ssize_t shall be signed integer types.

> I've committed these two patches adjusting idpriv-drop and
> idpriv-droptemp which previously stored the result of getuid () and
> getgid () in an 'int'. Not sure if this would cause issues on any of the
> platforms these modules support.

Hence using uid_t and gid_t here instead of int. It seems most platforms
use ≤ 32-bit values. Maybe it is possible that uid_t is unsigned and the
current user ID could not be represented in a 32-bit signed integer.

> For other modules where an ID is used as the result to printf it is
> often casted to an int. Should I change those to intmax_t? I feel like
> that would be the most portable way.

Correction here, intmax_t for printing pid_t values. For others, which
may be unsigned, uintmax_t after checking >= 0.

Collin

Reply via email to