ratbagd: provide a decent error message when the bus name is taken

sd-bus returns EEXISTS which is "File exists" and way too confusing. Let's
print out a decent error message for that case.

Relater #535
This commit is contained in:
Peter Hutterer
2018-09-10 12:33:36 +10:00
committed by Filipe Laíns
parent acc0066f08
commit a3de0e1ff7

View File

@@ -568,8 +568,12 @@ exit:
ratbagd_free(ctx);
if (r < 0) {
errno = -r;
log_error("Failed to start ratbagd: %m\n");
if (r == -EEXIST) {
log_error("Bus name is taken, another instance of ratbagd is already running.\n");
} else {
errno = -r;
log_error("Failed to start ratbagd: %m\n");
}
return EXIT_FAILURE;
}