]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: fix invalid error message
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 17 Oct 2017 23:57:54 +0000 (08:57 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 17 Oct 2017 23:57:59 +0000 (08:57 +0900)
The error message corresponds to EILSEQ is "Invalid or incomplete
multibyte or wide character", and is not suitable in this case.
So, let's show a custom error message when the function
dynamic_creds_realize() returns -EILSEQ.

src/core/execute.c

index c4dfac96d95560b03c16734debeda64bf8d11923..36dbc2870758e9d79679f45b86f9e39e62efe691 100644 (file)
@@ -2798,6 +2798,10 @@ static int exec_child(
                 r = dynamic_creds_realize(dcreds, suggested_paths, &uid, &gid);
                 if (r < 0) {
                         *exit_status = EXIT_USER;
+                        if (r == -EILSEQ) {
+                                log_unit_error(unit, "Failed to update dynamic user credentials: User or group with specified name already exists.");
+                                return -EOPNOTSUPP;
+                        }
                         return log_unit_error_errno(unit, r, "Failed to update dynamic user credentials: %m");
                 }