varient of do_open/do_open_nofollow which does do_open() if the copy_links or copy_unsafe_links options are set and does do_open_nofollow() otherwise This is used to prevent a race condition where an attacker could be switching a file between being a symlink and being a normal file The open is always done with O_RDONLY flags */
| 2141 | The open is always done with O_RDONLY flags |
| 2142 | */ |
| 2143 | int do_open_checklinks(const char *pathname) |
| 2144 | { |
| 2145 | if (copy_links || copy_unsafe_links) { |
| 2146 | return do_open(pathname, O_RDONLY, 0); |
| 2147 | } |
| 2148 | return do_open_nofollow(pathname, O_RDONLY); |
| 2149 | } |
no test coverage detected