]> git.ipfire.org Git - pakfire.git/commitdiff
util: Fix creating symlinks
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 16 Dec 2023 11:53:47 +0000 (11:53 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 16 Dec 2023 11:53:47 +0000 (11:53 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/util.c

index 6bb22195a9825e2f98a008099cf91c6e9a347fff..a3b9f266136eca2109bfcdfa344809ba50f0a3ab 100644 (file)
@@ -555,21 +555,21 @@ int pakfire_symlink(struct pakfire_ctx* ctx, const char* target, const char* lin
        int r;
 
        // Find the dirname of the target
-       r = pakfire_path_dirname(path, target);
+       r = pakfire_path_dirname(path, linkpath);
        if (r)
                return r;
 
        // Make the symlink relative
-       r = pakfire_path_relative(path, path, linkpath);
+       r = pakfire_path_relative(path, path, target);
        if (r)
                return r;
 
        CTX_DEBUG(ctx, "Creating symlink %s -> %s (%s)\n", target, linkpath, path);
 
        // Create the symlink
-       r = symlink(target, path);
+       r = symlink(path, linkpath);
        if (r) {
-               CTX_ERROR(ctx, "Could not create symlink %s (%s)\n", target, path);
+               CTX_ERROR(ctx, "Could not create symlink %s (%s): %m\n", linkpath, path);
                return r;
        }