top | item 44205957

(no title)

L3viathan | 8 months ago

Nitpick, but:

> At its core, a file descriptor (often abbreviated as fd) is simply a positive integer

A _non-negative_ integer.

discuss

order

DougN7|8 months ago

Ok, I have to ask: the difference between “positive” and “non-negative” is …?

cesarb|8 months ago

The integer numbers can be divided into "negative" (less than zero), zero, and "positive" (greater than zero). When one says "non-negative", they are excluding only the negative numbers, so zero is included; when one says "positive", zero is not included.

bregma|8 months ago

The difference is a classic off-by-one error that can lead to a security exploit.

rkomorn|8 months ago

0 is non-negative but also... non-positive?