summaryrefslogtreecommitdiff
path: root/src/shared/path-util.h
AgeCommit message (Collapse)Author
2014-09-25shared: path-util - try to make PATH_FORECH_PREFIX look less wrongTom Gundersen
We replace the idiom "X && !(*foo = 0)" with "X && ((*foo = 0), true)". This is not a functional change, but should hopefully make it less likely that people and static analyzers believe there is a typo here (i.e., to make it clear that the intention was not "X && *foo != 0"). Thanks to David Herrmann for the suggestion.
2014-07-26Add utility function to append root to pathZbigniew Jędrzejewski-Szmek
2014-06-20shared: rename path_strv_canonicalize_absolute functionsMichael Marineau
Since 12ed81d9 path_strv_canonicalize_absolute leaves the search list relative to the given root directory instead of resolving paths to their true location as the name implies. To better reflect this behavior rename to the less strongly worded path_strv_resolve.
2014-05-16path-util: add path_make_relative()Tanu Kaskinen
In user_dirs() in path-lookup.c, I want to replace this: symlink("../../../.config/systemd/user", data_home); with symlink(config_home, data_home); to avoid hardcoding .config when XDG_CONFIG_HOME is set. The problem is that config_home is an absolute path, and it's better to make the symlink relative. path_make_relative() is an utility function that converts an absolute path into a relative one.
2014-04-12fsck: Search for fsck.type in PATHMike Gilbert
Modifies find_binary() to accept NULL in the second argument. fsck.type lookup logic moved to new fsck_exists() function, with a test.
2014-02-14shared: include root when canonicalizing conf pathsMichael Marineau
The conf_files_list family accepts an alternate root path to prefix all directories in the list but path_strv_canonicalize_uniq doesn't use it. This results in the suspicious behavior of resolving directory symlinks based on the contents of / instead of the alternate root. This adds a prefix argument to path_strv_canonicalize which will now prepend the prefix, if given, to every path in the list. To avoid answering what a relative path means when called with a root prefix path_strv_canonicalize is now path_strv_canonicalize_absolute and only considers absolute paths. Fortunately all users of already call path_strv_canonicalize with a list of absolute paths.
2014-01-08No need to canonicalize fixed pathsZbigniew Jędrzejewski-Szmek
2013-12-20DEFAULT_PATH_SPLIT_USR macroShawn Landden
2013-12-06Get rid of our reimplementation of basenameZbigniew Jędrzejewski-Szmek
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-10-26udev: move udev_rules_check_timestamp to sharedTom Gundersen
I want to use this from a bulitin in a subsequent patch.
2013-09-26util: properly handle the root dir in PATH_FOREACH_PREFIXLennart Poettering
Also add PATH_FOREACH_PREFIX_MORE which includes the specified dir itself in the iteration
2013-09-25util: add macro for iterating through all prefixes of a pathLennart Poettering
Syntactic sugar in a macro PATH_FOREACH_PREFIX.
2013-09-09run: allow non-absolute paths as commandZbigniew Jędrzejewski-Szmek
2013-05-02Add __attribute__((const, pure, format)) in various placesZbigniew Jędrzejewski-Szmek
I'm assuming that it's fine if a _const_ or _pure_ function calls assert. It is assumed that the assert won't trigger, and even if it does, it can only trigger on the first call with a given set of parameters, and we don't care if the compiler moves the order of calls.
2013-04-16path-util: unify code for detecting OS treesLennart Poettering
This also makes sure we always detect an OS tree the same way, by checking for /etc/os-release.
2013-03-28tests: add some silly tests for path-util.cZbigniew Jędrzejewski-Szmek
2013-02-11binfmt,tmpfiles,modules-load,sysctl: rework the various early-boot services ↵Lennart Poettering
that work on .d/ directories This unifies much of the logic behind them: - All four will now ofllow the rule that the earlier file and earlier assignment in the .d/ directories wins. Before, sysctl was the only outlier, where the later setting always won. - All four now support getopt() and --help on the command line. - All four can now handle specification of configuration file names on the command line to apply. The tools will automatically find them, and apply them. Previously only tmpfiles could do that. This is useful for %post scripts in RPMs and suchlike. - This fixes various error path issues in conf_files_list()
2013-02-06shared: remove now unused functionZbigniew Jędrzejewski-Szmek
2012-09-14timedate: assorted improvementsLennart Poettering
- Make writing/reading of /etc/timezone dependendent of HAVE_SYSV_COMPAT - Introduce symlink_atomic() after all, and use it - Use relative symlink for /etc/localtime
2012-05-08path-util: there is no function path_parent()Lennart Poettering
2012-05-08util: split-out path-util.[ch]Kay Sievers