diff --git a/sch2fig/git-file.c b/sch2fig/git-file.c index 9e0cb0f..098f136 100644 --- a/sch2fig/git-file.c +++ b/sch2fig/git-file.c @@ -210,27 +210,20 @@ static char *canonical_path_into_repo(const char *repo_dir, const char *path) if (verbose > 1) fprintf(stderr, "full object path \"%s\"\n", tmp); - /* find which part of out path is inside the repo */ + /* find which part of our path is inside the repo */ end = tail = strchr(tmp, 0); while (1) { if (verbose > 2) fprintf(stderr, "trying \"%s\" tail \"%s\"\n", tmp, tail); - /* - * This should never fail, unless someone has been changing - * things while we were searching. - */ - if (stat(tmp, &path_st) < 0) { - perror(tmp); - exit(1); - } - if (path_st.st_dev == repo_st.st_dev && + if (stat(tmp, &path_st) == 0 && + path_st.st_dev == repo_st.st_dev && path_st.st_ino == repo_st.st_ino) break; - /* another "this cannot happen" problem */ + /* "this cannot happen" */ if (tail == tmp) { fprintf(stderr, "divergent paths:\nrepo \"%s\"\nobject \"%s\"\n",