|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 8c84621c25c563c7428f3d355136fc542389aab8 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Wed, 17 Sep 2014 23:03:27 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] sysv-generator: don't check first if hashmap contains the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
service name
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Just test if hashmap_get returns null. hashmap_contains does exactly
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
same thing internally so this is slightly more efficient for the true
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
case.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Silences a coverity warning too. CID#1237648
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/sysv-generator/sysv-generator.c | 5 ++---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 2 insertions(+), 3 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index e5902ab8f8..43bcaa862f 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/sysv-generator/sysv-generator.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/sysv-generator/sysv-generator.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -810,9 +810,8 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
goto finish;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- if (hashmap_contains(all_services, name))
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- service = hashmap_get(all_services, name);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- else {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ service = hashmap_get(all_services, name);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (!service){
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
log_warning("Could not find init script for %s", name);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
continue;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|