summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2015-02-19 11:06:24 +0100
committerMartin Pitt <martin.pitt@ubuntu.com>2015-02-19 11:06:24 +0100
commit4e5589836c9e143796c3f3d81e67ab7a9209e2b0 (patch)
treeffbfa7d26b7eecc73ee0fdb2c222851049aca9c4 /src
parent0377e373d1b4973effe14ca19e21f0c10740085d (diff)
sysv-generator: fix wrong "Overwriting existing symlink" warnings
Fix result testing of is_symlink() to ignore negative results, which happen if the file name does not exist at all. In this case we do not want a warning and unlink the non-existing link. https://bugs.debian.org/778700
Diffstat (limited to 'src')
-rw-r--r--src/sysv-generator/sysv-generator.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 2091854e08..bd67f321f6 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -166,7 +166,7 @@ static int generate_unit_file(SysvStub *s) {
/* We might already have a symlink with the same name from a Provides:,
* or from backup files like /etc/init.d/foo.bak. Real scripts always win,
* so remove an existing link */
- if (is_symlink(unit)) {
+ if (is_symlink(unit) > 0) {
log_warning("Overwriting existing symlink %s with real service", unit);
(void) unlink(unit);
}