[Toybox] [PATCH] dirtree.c: avoid spurious EINVAL warnings.

enh enh at google.com
Fri Dec 13 16:36:07 PST 2019


An Android engineer complained that they were seeing this when not
running as root:

  $ adb shell ls
  ls: ./postinstall: Invalid argument
  ls: ./init: Permission denied
  ls: ./data_mirror: Invalid argument
  ls: ./init.environ.rc: Invalid argument
  ls: ./metadata: Invalid argument
  acct
  adb_keys
  apex

>From strace, it was here:

  newfstatat(4, "adb_keys", 0x7fc67eca88, AT_SYMLINK_NOFOLLOW) = -1
EACCES (Permission denied)
  readlinkat(4, "adb_keys", 0x5e843c7720, 4095) = -1 EINVAL (Invalid argument)

So stop looking at st.st_mode (and then deciding to do a readlinkat())
if we didn't actually successfully stat().
---
 lib/dirtree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-dirtree.c-avoid-spurious-EINVAL-warnings.patch
Type: text/x-patch
Size: 1384 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20191213/98d8f32b/attachment-0002.bin>


More information about the Toybox mailing list