On Sun, Jul 26, 2020 at 4:33 PM Lassi Kortela <xxxxxx@lassi.io> wrote:

In general, operating on a file descriptor is always better than
operating on a pathname when you have the fd already open.

SRFI 170, however, is designed to provide a minimum of either fd or port operations.  You can translate between one and the other, but the intention is to use ports internally and fds only externally.
 
It is faster
(avoids pathname lookup) and, much more importantly, it avoids race
conditions when the underlying file has been moved and your program is
accidentally using a stale pathname.

IMO, if you have a stale pathname, you are most likely doing the Wrong Thing anyway.



John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
Why are well-meaning Westerners so concerned that the opening of a
Colonel Sanders in Beijing means the end of Chinese culture? [...]
We have had Chinese restaurants in America for over a century,
and it hasn't made us Chinese.  On the contrary, we obliged the Chinese
to invent chop suey.            --Marshall Sahlins