summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-27 22:39:10 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-27 22:39:10 +0100
commitc25fb0edbb8a1d4fc2e466a355e7d3e5ddeacd5e (patch)
treebb7a5c54ee96004ccb7d9b47bc753cf681e238a8
parentb2aa81efdef98f113c391a3081b8be5d05ef9566 (diff)
port fragment loader to new utility functions
-rw-r--r--load-fragment.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/load-fragment.c b/load-fragment.c
index 8bb29b2dcd..2df5c04f77 100644
--- a/load-fragment.c
+++ b/load-fragment.c
@@ -481,32 +481,6 @@ int config_parse_bindtodevice(
#define FOLLOW_MAX 8
-static char *build_path(const char *path, const char *filename) {
- char *e, *r;
- size_t k;
-
- assert(path);
- assert(filename);
-
- /* This removes the last component of path and appends
- * filename, unless the latter is absolute anyway or the
- * former isn't */
-
- if (path_is_absolute(filename))
- return strdup(filename);
-
- if (!(e = strrchr(path, '/')))
- return strdup(filename);
-
- k = strlen(filename);
- if (!(r = new(char, e-path+1+k+1)))
- return NULL;
-
- memcpy(r, path, e-path+1);
- memcpy(r+(e-path)+1, filename, k+1);
-
- return r;
-}
static int open_follow(char **filename, FILE **_f, Set *names, char **_id) {
unsigned c = 0;
@@ -553,7 +527,7 @@ static int open_follow(char **filename, FILE **_f, Set *names, char **_id) {
if ((r = readlink_malloc(*filename, &target)) < 0)
return r;
- k = build_path(*filename, target);
+ k = file_in_same_dir(*filename, target);
free(target);
if (!k)