diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-10-31 11:08:30 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-11-30 20:43:25 +0100 |
commit | b12d25a8d631af00b200e7aa9dbba6ba4a4a59ff (patch) | |
tree | 77bbba004085576e5e646ba4a64c6981b4043cbf /src/basic/stat-util.c | |
parent | ca4d708dc4092268520aee419cbd696f1b0f4558 (diff) | |
download | systemd-b12d25a8d631af00b200e7aa9dbba6ba4a4a59ff.tar.gz |
util-lib: use trailing slash in chase_symlinks, fd_is_mount_point, path_is_mount_point
The kernel will reply with -ENOTDIR when we try to access a non-directory under
a name which ends with a slash. But our functions would strip the trailing slash
under various circumstances. Keep the trailing slash, so that
path_is_mount_point("/path/to/file/") return -ENOTDIR when /path/to/file/ is a file.
Tests are added for this change in behaviour.
Also, when called with a trailing slash, path_is_mount_point() would get
"" from basename(), and call name_to_handle_at(3, "", ...), and always
return -ENOENT. Now it'll return -ENOTDIR if the mount point is a file, and
true if it is a directory and a mount point.
v2:
- use strip_trailing_chars()
v3:
- instead of stripping trailing chars(), do the opposite — preserve them.
Diffstat (limited to 'src/basic/stat-util.c')
0 files changed, 0 insertions, 0 deletions