|
|
923a60 |
From b5eddaf0dea35bda7b68a401119c5f9f9104fb99 Mon Sep 17 00:00:00 2001
|
|
|
923a60 |
From: Martin Pitt <martin.pitt@ubuntu.com>
|
|
|
923a60 |
Date: Mon, 11 Apr 2016 21:03:29 +0200
|
|
|
923a60 |
Subject: [PATCH] Install: correctly report symlink creations
|
|
|
923a60 |
|
|
|
923a60 |
All callers of create_symlink(), such as install_info_symlink_wants(), expect
|
|
|
923a60 |
that to return > 0 if it actually did something, and then return that number.
|
|
|
923a60 |
unit_file_enable() uses that to determine if any action was done
|
|
|
923a60 |
(carries_install_info != 0) and if not, show a "The unit files have no
|
|
|
923a60 |
[Install] section" warning.
|
|
|
923a60 |
|
|
|
923a60 |
Return 1 instead of 0 in the two code paths of create_symlink() when the link
|
|
|
923a60 |
was created or replaced with a new value.
|
|
|
923a60 |
|
|
|
923a60 |
This fixes getting a bogus "No [Install] section" warning when enabling a unit
|
|
|
923a60 |
with full path, like "systemctl enable /some/path/myunit.service".
|
|
|
923a60 |
|
|
|
923a60 |
(cherry picked from commit 3de1521427dee61000c1c124a521182b301a50de)
|
|
|
923a60 |
Resolves: #1435098
|
|
|
923a60 |
---
|
|
|
923a60 |
src/shared/install.c | 4 ++--
|
|
|
923a60 |
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
923a60 |
|
|
|
923a60 |
diff --git a/src/shared/install.c b/src/shared/install.c
|
|
|
923a60 |
index bdfd7b96a2..e73f0c95bd 100644
|
|
|
923a60 |
--- a/src/shared/install.c
|
|
|
923a60 |
+++ b/src/shared/install.c
|
|
|
923a60 |
@@ -283,7 +283,7 @@ static int create_symlink(
|
|
|
923a60 |
|
|
|
923a60 |
if (symlink(old_path, new_path) >= 0) {
|
|
|
923a60 |
unit_file_changes_add(changes, n_changes, UNIT_FILE_SYMLINK, new_path, old_path);
|
|
|
923a60 |
- return 0;
|
|
|
923a60 |
+ return 1;
|
|
|
923a60 |
}
|
|
|
923a60 |
|
|
|
923a60 |
if (errno != EEXIST)
|
|
|
923a60 |
@@ -306,7 +306,7 @@ static int create_symlink(
|
|
|
923a60 |
unit_file_changes_add(changes, n_changes, UNIT_FILE_UNLINK, new_path, NULL);
|
|
|
923a60 |
unit_file_changes_add(changes, n_changes, UNIT_FILE_SYMLINK, new_path, old_path);
|
|
|
923a60 |
|
|
|
923a60 |
- return 0;
|
|
|
923a60 |
+ return 1;
|
|
|
923a60 |
}
|
|
|
923a60 |
|
|
|
923a60 |
static int mark_symlink_for_removal(
|