]>
Commit | Line | Data |
---|---|---|
5e012f76 JK |
1 | |
2 | based on: | |
3 | ||
4 | From 4e5589836c9e143796c3f3d81e67ab7a9209e2b0 Mon Sep 17 00:00:00 2001 | |
5 | From: Martin Pitt <martin.pitt@ubuntu.com> | |
6 | Date: Thu, 19 Feb 2015 11:06:24 +0100 | |
7 | Subject: sysv-generator: fix wrong "Overwriting existing symlink" warnings | |
8 | ||
9 | Fix result testing of is_symlink() to ignore negative results, which happen if | |
10 | the file name does not exist at all. In this case we do not want a warning and | |
11 | unlink the non-existing link. | |
12 | ||
13 | https://bugs.debian.org/778700 | |
14 | ||
15 | diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c | |
16 | index 2091854..bd67f32 100644 | |
17 | --- a/src/sysv-generator/sysv-generator.c | |
18 | +++ b/src/sysv-generator/sysv-generator.c | |
19 | @@ -166,7 +166,7 @@ static int generate_unit_file(SysvStub *s) { | |
20 | /* We might already have a symlink with the same name from a Provides:, | |
21 | * or from backup files like /etc/init.d/foo.bak. Real scripts always win, | |
22 | * so remove an existing link */ | |
23 | - if (is_symlink(unit)) { | |
24 | + if (is_symlink(unit) > 0) { | |
25 | log_warning("Overwriting existing symlink %s with real service", unit); | |
26 | (void) unlink(unit); | |
27 | } | |
28 |