sys-fs/ksmbd-tools: fix control return codes

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Guillaume Castagnino <casta@xwing.info>
This commit is contained in:
Guillaume Castagnino 2021-11-03 11:19:53 +01:00
parent edec1a9eaa
commit 4161562f26
Signed by: casta
GPG key ID: C47D4BFADB084424
3 changed files with 57 additions and 2 deletions

View file

@ -1,4 +1,5 @@
AUX ksmbd-tools-fix-control-return-code.patch 1398 BLAKE2B 27167953e0fc017ae9e52935cee9685bc006d13ee9597aa0566ba4c7ae5e659cf5f73b5ec11cf16ff6d08078be55e2d67c579bb2430bcce55c7d7dceeae39090 SHA512 fbd37952407e5ec218b261f69c8976c2e25d6def7fb4f0ce06ea4983d0b77a7ee3628d21503e63601085f3a8ec3004a9d02bdb729ade562b54fdb58ac1141438
AUX ksmbd.service 394 BLAKE2B 92a619478fc52421005655dbdedc109df0f6054bb0a8b2f5359b66fcf2c84582ebf80092efcce3894948038d5fe0c154189bdf679aab6fa67c5adcc25e3a959e SHA512 0749f438cf89fce0c218828e0c267c5d761adf66de089d4c9440b61cf5f0620400caeeebb4bfb0959aea63671ce54082a348f0228c40ed91e288256ddce6b34b
DIST a1144518d74a26e0a45c0c1685f56f0f695bb497.zip 110359 BLAKE2B 29ec05e01c4f6c280793b3ef3e6d11e033cab5c3b39fdf3365a9f3d3c02ea56ff4ccb5cbaac14cb17508fac2a5f954b825e5d9566af9189569801bc4b5c03caf SHA512 9d885c1084991798aea33855f58ebd261b22d46514e1cd25cbf434828d8ca108d0097693034364558daea4fd96c48dbf64f1422d3449e00f0f125b65592a3a23
EBUILD ksmbd-tools-3.4.2_p20211026-r1.ebuild 993 BLAKE2B 7bda632bd7d001fa997ced246f4396c77ab7e1331a6e2494753071d55cf7ca1c91cb1ac0fbc380f2ff49b427822350deda259b6fbca5b17c2e01da8a1c4c4c77 SHA512 56e6d879038a45c5d882fc812c1e0a5f63c357ebc1f3dadaca0aeecef8abcea1fc00fa2d788d64a8d1a444f50c319e2edea91152a524c9ae6ee3b9fe3b293ead
EBUILD ksmbd-tools-3.4.2_p20211026-r2.ebuild 1054 BLAKE2B d63b57202db385fc6a46f9fbe0388c852932e15255e76dcde3b06cd8258994fab01667ae54706b5521919afb13d263465587d0235ae40a4ccd2f0e3ba0039dc5 SHA512 fd767eee75f06bf00c4351fb4efd82dd156abf05889cfc68300e843e72a45ba5ef9b44bc8bdc4ce3b7ef719fa9c085355897c3e3aac812465a7710ee3625cc52
MISC metadata.xml 253 BLAKE2B ac50d70479526513b1c60d14e609cc24c0498bc5124837f8d20b5d5989cc3876c3e4878ac177658f4be088dd5731142eaefff3ec5aac963efe756eabc5ed26c1 SHA512 96696bc7a2e0f4c1447a44241c7aec867015c37f73f958b72b8489a5038b551f1700dc5540651129a19ab29ce58c4be88bea1226f31b846fb285a25ba4cd61e9

View file

@ -0,0 +1,49 @@
commit 0905c42d80152a28005cd132c19197bf579cada8
Author: Guillaume Castagnino <guillaume.castagnino@rohde-schwarz.com>
Date: Wed Nov 3 11:16:05 2021 +0100
Standardize exit codes
In case of success, EXIT_SUCCESS must be returned by the control binary
This standard behaviour is expected for example for the unit file
diff --git a/control/control.c b/control/control.c
index 5b86355..5ff2780 100644
--- a/control/control.c
+++ b/control/control.c
@@ -43,7 +43,7 @@ static int ksmbd_control_shutdown(void)
ret = write(fd, "hard", 4);
close(fd);
- return ret;
+ return ret != -1 ? EXIT_SUCCESS : EXIT_FAILURE;
}
static int ksmbd_control_show_version(void)
@@ -61,7 +61,7 @@ static int ksmbd_control_show_version(void)
close(fd);
if (ret != -1)
pr_info("ksmbd version : %s\n", ver);
- return ret;
+ return ret != -1 ? EXIT_SUCCESS : EXIT_FAILURE;
}
static int ksmbd_control_debug(char *comp)
@@ -85,7 +85,7 @@ static int ksmbd_control_debug(char *comp)
pr_info("%s\n", buf);
out:
close(fd);
- return ret;
+ return ret != -1 ? EXIT_SUCCESS : EXIT_FAILURE;
}
int main(int argc, char *argv[])
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
while ((c = getopt(argc, argv, "sd:cVh")) != EOF)
switch (c) {
case 's':
- ksmbd_control_shutdown();
+ ret = ksmbd_control_shutdown();
break;
case 'd':
ret = ksmbd_control_debug(optarg);

View file

@ -27,8 +27,13 @@ BDEPEND=""
S="${WORKDIR}/${PN}-${HASH}"
PATCHES=(
"${FILESDIR}/${PN}-fix-control-return-code.patch"
)
src_prepare() {
eapply_user
default
eautoreconf
}