Commit Graph

51570 Commits

Author SHA1 Message Date
Yu Watanabe
48008c1cbf tree-wide: fix typo 2021-05-28 19:52:12 +09:00
Yu Watanabe
7f1238bd04 basic/unit-file: fix use-after-free
This fixes a bug introduced by e8630e6952.

Fixes CID#1453292.
2021-05-28 19:48:38 +09:00
Yu Watanabe
a04842dfb2 network,sd-hwdb: voidify fchmod()
Fixes CID#1453294.
2021-05-28 19:41:07 +09:00
Yu Watanabe
50fd596efc path-util: add missing varargs cleanup
Fixes CID#1453293.
2021-05-28 19:38:37 +09:00
Lennart Poettering
18503cac41 Merge pull request #19485 from yuwata/path-util
path-util: introduce several path utilities and handle "." more gracefully
2021-05-28 09:31:06 +02:00
Yu Watanabe
cb71ed91f7 path-util: make path_simplify() use path_find_first_component() 2021-05-28 13:44:38 +09:00
Yu Watanabe
4ff361cc86 tree-wide: always drop unnecessary dot in path 2021-05-28 13:44:38 +09:00
Yu Watanabe
0195046449 path-util: make path_extract_filename/directory() handle "." gracefully
This makes the functions handle "xx/" and "xx/." as equivalent.
Moreover, now path_extract_directory() returns normalized path, that is
no redundant "/" or "/./" are contained.
2021-05-28 13:44:38 +09:00
Yu Watanabe
484cd43cae path-util: introduce path_find_last_component() 2021-05-28 13:44:38 +09:00
Yu Watanabe
15bac3e8fd path-util: use path_equal() in empty_or_root() 2021-05-28 13:44:38 +09:00
Yu Watanabe
39d7af99c2 fs-util: make chase_symlinks() use path_find_first_component()
The previous commit about path_compare() breaks chase_symlinks().
This commit fixes it.
2021-05-28 13:44:19 +09:00
Yu Watanabe
353df4438e path-util: make path_compare() and path_hash_func() ignore "."
This also makes path_compare() may return arbitrary integer as it now
simply pass the result of strcmp() or memcmp().

This changes the behavior of path_extract_filename/directory() when
e.g. "/." or "/./" are input. But the change should be desired.
2021-05-28 13:41:23 +09:00
Yu Watanabe
fe69c41ee8 path-util: use path_find_first_component() in path_make_relative()
This also makes the function checks the result is a valid path or not.
2021-05-28 13:41:23 +09:00
Yu Watanabe
63f11e354a path-util: use path_find_first_component() in path_startswith()
This makes path_startswith() stricter. If one of the path component in
arguments is longer than NAME_MAX, it returns NULL.
2021-05-28 13:41:23 +09:00
Yu Watanabe
0b8696256b path-util: use path_is_safe() in path_is_normalized() 2021-05-28 13:41:23 +09:00
Yu Watanabe
32df2e1447 path-util: introduce path_is_safe()
The function is similar to path_is_valid(), but it refuses paths which
contain ".." component.
2021-05-28 13:41:23 +09:00
Yu Watanabe
6636883564 path-util: use path_find_first_component() in path_is_valid() 2021-05-28 13:41:23 +09:00
Yu Watanabe
0ee54dd4e2 path-util: introduce path_find_first_component()
The function may be useful to iterate on each path component.
2021-05-28 13:41:23 +09:00
Yu Watanabe
340cd6b6f9 path-util: fix off by one issue to detect slash at the end in path_extend() 2021-05-28 13:41:23 +09:00
Dan Streetman
05575a104b test/networkd-test: in bridge test, wait for online after restart systemd-networkd
without waiting for online, there is a race condition between systemd-networkd
actually setting the new values and the test checking those values

This also sets the link down before restarting systemd-networkd, to avoid
the wait for online being a no-op
2021-05-28 12:26:33 +09:00
Peter Kjellerstedt
b2d7487071 meson: Correctly validate that prefix is a child of rootprefix
In commit d895e10a a test was introduced to validate that prefix is a
child of rootprefix. However, it only works when rootprefix is "/".
Since the test is ignored when rootprefix is equal to prefix, this is
only noticed if specifying both -Drootprefix= and -Dprefix=, e.g.:

  $ meson foo -Drootprefix=/foo -Dprefix=/foo/bar
  meson.build:111:8: ERROR: Problem encountered: Prefix is not below
  root prefix (now rootprefix=/foo prefix=/foo/bar)
2021-05-28 06:29:45 +09:00
Yu Watanabe
4e95bc56df Merge pull request #19749 from poettering/path-extend
add path_extend() helper which is a like if path_join() and strextend() had a baby
2021-05-28 05:53:57 +09:00
Lennart Poettering
4ede980249 tree-wide: make use of path_extend() at many places
This is not a comprehensive port, but mostly some low-hanging fruit.
2021-05-27 17:05:38 +02:00
Lennart Poettering
7ae2768028 path-util: add path_extend(), inspired by strextend(), but using path_join() 2021-05-27 16:02:18 +02:00
Yu Watanabe
38dd7673b3 Merge pull request #19703 from yuwata/network-ndisc-valid-time
network: ndisc: always honor valid time
2021-05-27 18:42:31 +09:00