1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-22 20:41:54 +02:00

eeshow/git-file.c (canonical_path_into_repo): really catch divergent paths

This commit is contained in:
Werner Almesberger 2016-08-07 16:13:28 -03:00
parent 43542d6504
commit aeedab62f7

View File

@ -237,15 +237,16 @@ static char *canonical_path_into_repo(const char *repo_dir, const char *path)
path_st.st_ino == repo_st.st_ino)
break;
slash = strrchr(tmp, '/');
/* "this cannot happen" */
if (tail == tmp) {
if (tail == tmp || !slash) {
fprintf(stderr,
"divergent paths:\nrepo \"%s\"\nobject \"%s\"\n",
repo_dir, tmp);
repo_dir, tail);
exit(1);
}
slash = strrchr(tmp, '/');
if (tail != end)
tail[-1] = '/';
tail = slash + 1;