diff --git a/attr.c b/attr.c index 466c93fa509..bb9a470c851 100644 --- a/attr.c +++ b/attr.c @@ -583,6 +583,13 @@ static void prepare_attr_stack(const char *path) dirlen = find_basename(path) - path; + /* + * find_basename() includes the trailing slash, but we do + * _not_ want it. + */ + if (dirlen) + dirlen--; + /* * At the bottom of the attribute stack is the built-in * set of attribute definitions, followed by the contents