- if (!streq(i->argument, x)) {
- log_error("%s is not the right symlinks.", i->path);
- return -EEXIST;
+ r = readlink_malloc(i->path, &x);
+ if (r < 0 || !streq(i->argument, x)) {
+
+ if (i->force) {
+ mac_selinux_create_file_prepare(i->path, S_IFLNK);
+ r = symlink_atomic(i->argument, i->path);
+ mac_selinux_create_file_clear();
+
+ if (r < 0)
+ return log_error_errno(r, "symlink(%s, %s) failed: %m", i->argument, i->path);
+ } else {
+ log_debug("%s is not a symlink or does not point to the correct path.", i->path);
+ return 0;
+ }
+ }