[Toybox] dirtree_parentfd broken
enh
enh at google.com
Sat Nov 14 09:45:32 PST 2015
struct dirtree {
...
int data; // dirfd for directory, linklen for symlink
but:
int dirtree_parentfd(struct dirtree *node)
{
return node->parent ? node->parent->data : AT_FDCWD;
}
this shows up in ls if you "ls -Z some-symlink", because of this:
int fd = openat(dirtree_parentfd(new), new->name,
O_PATH|(O_NOFOLLOW*!!(toys.optflags&FLAG_L)));
which means we end up trying to openat relative to an int that's the
length of the symlink target, not actually an fd.
--
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
1447523132.0
More information about the Toybox
mailing list