~mirabilos/klibc/master

Viewing all changes in revision 2213.

  • Committer: Ben Hutchings
  • Date: 2022-12-31 15:04:19 UTC
  • Revision ID: git-v1:3d63cd68496a1c8aeccbdac6488bc1f002700bc8
[klibc] ls: Handle relative directory names correctly

ls currently starts to list a directory with chdir(path) and
opendir(path).  This obviously fails for relative names.  That could
be fixed by using opendir(".") instead.  However, if multiple relative
directory names are given, this would still fail after the first such
directory.

Instead, leave the current directory unchanged and use the fstatat()
and readlinkat() functions to get information about files in each
directory.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: