"Shawn O. Pearce" <spearce@xxxxxxxxxxx> wrote: > Junio C Hamano <gitster@xxxxxxxxx> wrote: > > static int lock_file(struct lock_file *lk, const char *path) > > { > > int fd; > > + struct stat st; > > + > > + if ((!lstat(path, &st)) && S_ISLNK(st.st_mode)) { > > + ssize_t sz; > > + static char target[PATH_MAX]; > > + sz = readlink(path, target, sizeof(target)); > > + if (sz < 0) > > + warning("Cannot readlink %s", path); > > + else > > + path = target; > > + } > > sprintf(lk->filename, "%s.lock", path); > > fd = open(lk->filename, O_RDWR | O_CREAT | O_EXCL, 0666); > > if (0 <= fd) { > > Right. But don't you have to resolve target relative to path? > If the symlink is an absolute path its fine as-is, but if it was > relative its relative to path, not pwd. It might just be OK to refuse to lock a symlink that isn't absolute. git-new-workdir already uses absolute paths to setup the symlinks. -- Shawn. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html