+
+ /* Remove duplicate inodes from the list of ambiguous files, since if there are symlinks
+ in the session path it is possible to arrive at the same file via more than one path.
+ */
+
+ vector<string> de_duped_hits;
+
+ for (vector<string>::iterator i = hits.begin(); i != hits.end(); ++i) {
+
+ vector<string>::iterator j = i;
+ ++j;
+
+ while (j != hits.end()) {
+
+ struct stat bufA;
+ int const rA = stat (i->c_str(), &bufA);
+ struct stat bufB;
+ int const rB = stat (j->c_str(), &bufB);
+
+ if (rA == 0 && rB == 0 && bufA.st_ino == bufB.st_ino) {
+ /* *i and *j are the same file; break out of the loop early */
+ break;
+ }
+
+ ++j;
+ }
+
+ if (j == hits.end ()) {
+ de_duped_hits.push_back (*i);
+ }
+ }
+
+ if (de_duped_hits.size() > 1) {
+
+ /* more than one match: ask the user */
+
+ int which = FileSource::AmbiguousFileName (path, search_path, de_duped_hits).get_value_or (-1);
+