|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
From efbd654ae84bc8033affed03538429b51eac02e8 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
Date: Wed, 18 Oct 2017 08:57:54 +0900
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
Subject: [PATCH] core: fix invalid error message
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
The error message corresponds to EILSEQ is "Invalid or incomplete
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
multibyte or wide character", and is not suitable in this case.
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
So, let's show a custom error message when the function
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
dynamic_creds_realize() returns -EILSEQ.
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
(cherry picked from commit e2b0cc3415980f7a145f8772f4ae0a4ad0fbe85a)
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
src/core/execute.c | 4 ++++
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
1 file changed, 4 insertions(+)
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
diff --git a/src/core/execute.c b/src/core/execute.c
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
index ef95a75e75..239ad7bcfd 100644
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
--- a/src/core/execute.c
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
+++ b/src/core/execute.c
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
@@ -2798,6 +2798,10 @@ static int exec_child(
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
r = dynamic_creds_realize(dcreds, suggested_paths, &uid, &gid;;
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
if (r < 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
*exit_status = EXIT_USER;
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
+ if (r == -EILSEQ) {
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
+ log_unit_error(unit, "Failed to update dynamic user credentials: User or group with specified name already exists.");
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
+ return -EOPNOTSUPP;
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
+ }
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
return log_unit_error_errno(unit, r, "Failed to update dynamic user credentials: %m");
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
35bb94 |
|