Lennart Poettering
3f72b427b4
path-util: make use of "mnt_id" field exported in /proc/self/fdinfo/<fd> to test for mount points
...
It's a very recent kernel addition, but certainly makes sense to
support.
2015-04-23 13:40:54 +02:00
Lennart Poettering
da00518b3f
path-util: fix more path_is_mount e792e890f
fallout
2015-04-07 16:03:45 +02:00
Lennart Poettering
c687863750
util: rework rm_rf() logic
...
- Move to its own file rm-rf.c
- Change parameters into a single flags parameter
- Remove "honour sticky" logic, it's unused these days
2015-04-06 10:57:53 +02:00
Michal Schmidt
2230852bd9
shared: add path_compare(), an ordering path comparison
...
... and make path_equal() a simple wrapper around it.
2015-03-16 22:01:41 +01:00
Zbigniew Jędrzejewski-Szmek
bc854dc7cd
systemctl: refuse to edit runtime dropins when they already exist in /etc
...
The check for existing unit files and dropins is unified.
path_join() is updated to not insert duplicate separators.
2014-12-16 00:30:34 -05:00
Thomas Hindoe Paaboel Andersen
f08c4c08c7
test-path-util: fix a leak
2014-12-04 00:13:10 +01:00
Zbigniew Jędrzejewski-Szmek
b63bd1090b
Do not check for existence of remote binaries
...
systemd-run would fail when run with -M or -H and an absolute path,
if this path did not exists locally. Allow it to continue, since we
don't have a nice way of checking if the binary exists remotely.
The case where -M or -H is used and a local path is unchanged, and we
still iterate over $PATH to find the binary. We need to convert to an
absolute path, and we don't have a nice mechanism to check remotely,
so we assume that the binary will be located in the same place locally
and remotely.
http://lists.freedesktop.org/archives/systemd-devel/2014-November/025418.html
2014-11-22 18:01:43 -05:00
Ronny Chevalier
5895b62f1d
tests: add tests for path_startswith
2014-10-31 10:57:21 +01:00
Thomas Hindoe Paaboel Andersen
59ae3a9573
test-path-util: fix a mem leak and avoid confusing coverity
...
Found with coverity. Fixes CID#1237754 and #1237790
2014-09-30 22:28:46 +02:00
Filipe Brandenburger
8d95631ea6
test-path-util: use assert_se in all assertions
...
Otherwise they get optimized out when CPPFLAGS='-DNDEBUG' is used, and that
causes the tests to fail.
Tested:
- make check TESTS='test-path-util' CPPFLAGS='-DNDEBUG'
2014-08-26 20:31:31 +02:00
Zbigniew Jędrzejewski-Szmek
0c6ea3a4e2
Add utility function to append root to path
2014-07-26 15:08:42 -04:00
Thomas Hindoe Paaboel Andersen
c8b32e11ee
consistently order cleanup attribute before type
2014-06-22 00:45:15 +02:00
Michael Marineau
3e8a78c8dc
test: unit test for using alternate roots with path_strv_resolve
2014-06-20 00:10:47 -04:00
Tanu Kaskinen
6b56a65123
test-path-util: add tests for path_make_relative()
2014-05-25 11:21:24 +08:00
Zbigniew Jędrzejewski-Szmek
7f076504b8
test-path-util: fix running with separate build dir
...
test-path-utils attempts to find itself, but if the binary is not
in current directory, the test would fail.
2014-04-16 22:04:48 -04:00
Zbigniew Jędrzejewski-Szmek
b972115c97
path-util: also check for existence of binary when given absolute path
...
In contrast to a filename-only argument, find_binary() did not
actually check if an path exists, allowing the code to fail later on.
This was OK, but it seems nicer to treat both paths identically.
Also take advantage of path_make_absolute_cwd doing strdup() by itself
if necessary to simplify.
2014-04-12 17:23:13 -04:00
Mike Gilbert
eb66db55fc
fsck: Search for fsck.type in PATH
...
Modifies find_binary() to accept NULL in the second argument.
fsck.type lookup logic moved to new fsck_exists() function, with a test.
2014-04-12 17:23:13 -04:00
Zbigniew Jędrzejewski-Szmek
2b6bf07dd2
Get rid of our reimplementation of basename
...
The only problem is that libgen.h #defines basename to point to it's
own broken implementation instead of the GNU one. This can be fixed
by #undefining basename.
2013-12-06 21:29:55 -05:00
Lennart Poettering
e203f7c3ad
util: properly handle the root dir in PATH_FOREACH_PREFIX
...
Also add PATH_FOREACH_PREFIX_MORE which includes the specified dir
itself in the iteration
2013-09-26 20:20:30 +02:00
Lennart Poettering
fecffe5d0a
util: add macro for iterating through all prefixes of a path
...
Syntactic sugar in a macro PATH_FOREACH_PREFIX.
2013-09-25 21:04:35 +02:00
Zbigniew Jędrzejewski-Szmek
c9d954b27e
run: allow non-absolute paths as command
2013-09-09 13:49:30 -04:00
Zbigniew Jędrzejewski-Szmek
b463b81399
test-path-util,test-sched-prio: uninitialize manager to appease valgrind
2013-07-12 13:24:06 -04:00
Zbigniew Jędrzejewski-Szmek
a696dbef34
test-path-util: fix another stupid test failure
2013-03-29 20:30:21 -04:00
Zbigniew Jędrzejewski-Szmek
590f50130f
test-path-util: fix botched test
2013-03-29 10:49:06 -04:00
Zbigniew Jędrzejewski-Szmek
76877b46b6
tests: add some silly tests for path-util.c
2013-03-28 23:45:59 -04:00