In the previous commit, I removed the initial initialization of the
names array, not realizing that scandir() is expected to return
a non-null (but empty) array of entries if no entries matched.
Restore the historical behavior, document it, and add a test.
Fixes: deeebfdecab5
Sponsored by: Klara, Inc.