projects
/
oweals
/
dinit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1b00dab
)
Improve diagnostic on attempt to add dependency from service to itself
author
Davin McCall
<davmac@davmac.org>
Sun, 21 Jun 2020 11:01:50 +0000
(21:01 +1000)
committer
Davin McCall
<davmac@davmac.org>
Sun, 21 Jun 2020 11:01:50 +0000
(21:01 +1000)
src/dinitctl.cc
patch
|
blob
|
history
diff --git
a/src/dinitctl.cc
b/src/dinitctl.cc
index b884be31aa57afa830d6d155d0a78eb835d18b87..6077bf11a0f2c76f4357eb25a19f731131d2755f 100644
(file)
--- a/
src/dinitctl.cc
+++ b/
src/dinitctl.cc
@@
-978,6
+978,11
@@
static int add_remove_dependency(int socknum, cpbuffer_t &rbuffer, bool add,
return 1;
}
+ if (from_handle == to_handle) {
+ cerr << "dinitctl: Can not add/remove a dependency from a service to itself" << endl;
+ return 1;
+ }
+
auto m = membuf()
.append<char>(add ? (char)DINIT_CP_ADD_DEP : (char)DINIT_CP_REM_DEP)
.append(static_cast<char>(dep_type))