2015-02-10 9:05 GMT+01:00 László Böszörményi (GCS) <g...@debian.org>: > Still fails on kFreeBSD.
Then I will need a little help, please: can you debug what happens when patch tries to traverse_path() "dir/foo/bar"? It should try to openat() subdirectory "foo" in "dir", the openat() should fail with errno == ELOOP, and patch should terminate. But maybe FreeBSD returns some other errno like ENOTDIR. Maybe it's as simple as the attached patch. Thanks, Andreas
diff --git a/src/safe.c b/src/safe.c index eec6ce5..b5a51ba 100644 --- a/src/safe.c +++ b/src/safe.c @@ -284,6 +284,12 @@ static int traverse_another_path (const char **pathname, int keepfd) (int) (path - *pathname), *pathname); fatal_exit (0); } + if (errno == ENOTDIR) + { + fprintf (stderr, "File %.*s is not a directory\n", + (int) (path - *pathname), *pathname); + fatal_exit (0); + } return dirfd; } }