ensure_file() in utils.c intends to reject symlinks as bind-mount destinations — the comment says "non-directory, non-symlink is acceptable" and the code checks !S_ISLNK(buf.st_mode).
However, it uses stat() which follows symlinks. Since stat() resolves the symlink before returning, S_ISLNK() is never true for valid symlinks, making the check dead code.
|
We're trying to set up a mount point for a non-directory, so any |
|
non-directory, non-symlink is acceptable - it doesn't necessarily |
|
have to be a regular file. */ |
|
if (stat (path, &buf) == 0 && |
|
!S_ISDIR (buf.st_mode) && |
|
!S_ISLNK (buf.st_mode)) |
|
return 0; |
Should use lstat() so the S_ISLNK check works as intended.
ensure_file()inutils.cintends to reject symlinks as bind-mount destinations — the comment says "non-directory, non-symlink is acceptable" and the code checks!S_ISLNK(buf.st_mode).However, it uses
stat()which follows symlinks. Sincestat()resolves the symlink before returning,S_ISLNK()is never true for valid symlinks, making the check dead code.bubblewrap/utils.c
Lines 513 to 519 in 0c408e1
Should use
lstat()so theS_ISLNKcheck works as intended.