summaryrefslogtreecommitdiff
path: root/src/load-fragment.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-16 01:56:00 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-16 01:56:00 +0200
commit2c7108c40abfb1f175391aa59cf1b07ab203e690 (patch)
treea9c2d8ddd55b3ad212c4e5c4b998bf3e7a4bb4f0 /src/load-fragment.c
parentb08a35509c1e09ac3ec2de37a259ff0fbbe69928 (diff)
util: introduce readlink_and_make_absolute()
Diffstat (limited to 'src/load-fragment.c')
-rw-r--r--src/load-fragment.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/load-fragment.c b/src/load-fragment.c
index 79b0893add..793c952594 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -1160,7 +1160,7 @@ static int open_follow(char **filename, FILE **_f, Set *names, char **_final) {
* reached by a symlink. The old string will be freed. */
for (;;) {
- char *target, *k, *name;
+ char *target, *name;
if (c++ >= FOLLOW_MAX)
return -ELOOP;
@@ -1189,17 +1189,11 @@ static int open_follow(char **filename, FILE **_f, Set *names, char **_final) {
return -errno;
/* Hmm, so this is a symlink. Let's read the name, and follow it manually */
- if ((r = readlink_malloc(*filename, &target)) < 0)
+ if ((r = readlink_and_make_absolute(*filename, &target)) < 0)
return r;
- k = file_in_same_dir(*filename, target);
- free(target);
-
- if (!k)
- return -ENOMEM;
-
free(*filename);
- *filename = k;
+ *filename = target;
}
if (!(f = fdopen(fd, "r"))) {