Merge pull request #9917 from keszybz/cleanups

Some unrelated fixups for recent PRs
This commit is contained in:
Yu Watanabe
2018-08-24 10:43:41 +09:00
committed by GitHub
4 changed files with 21 additions and 16 deletions
+4 -4
View File
@@ -532,10 +532,10 @@ static int pretty_boot_time(sd_bus *bus, char **_buf) {
strpcpyf(&ptr, size, "= %s ", format_timespan(ts, sizeof(ts), t->firmware_time + t->finish_time, USEC_PER_MSEC));
if (unit_id && activated_time > 0 && activated_time != USEC_INFINITY) {
if (t->userspace_time > 0)
size = strpcpyf(&ptr, size, "\n%s reached after %s in userspace", unit_id, format_timespan(ts, sizeof(ts), activated_time - t->userspace_time, USEC_PER_MSEC));
else
size = strpcpyf(&ptr, size, "\n%s reached after %s in userspace", unit_id, format_timespan(ts, sizeof(ts), activated_time - t->reverse_offset, USEC_PER_MSEC));
usec_t base = t->userspace_time > 0 ? t->userspace_time : t->reverse_offset;
size = strpcpyf(&ptr, size, "\n%s reached after %s in userspace", unit_id,
format_timespan(ts, sizeof(ts), activated_time - base, USEC_PER_MSEC));
} else if (unit_id && activated_time == 0)
size = strpcpyf(&ptr, size, "\n%s was never reached", unit_id);
else if (unit_id && activated_time == USEC_INFINITY)
+4 -3
View File
@@ -21,7 +21,8 @@ static const char* const fou_encap_type_table[_NETDEV_FOO_OVER_UDP_ENCAP_MAX] =
};
DEFINE_STRING_TABLE_LOOKUP(fou_encap_type, FooOverUDPEncapType);
DEFINE_CONFIG_PARSE_ENUM(config_parse_fou_encap_type, fou_encap_type, FooOverUDPEncapType, "Failed to parse Foo Over UDP Encap type");
DEFINE_CONFIG_PARSE_ENUM(config_parse_fou_encap_type, fou_encap_type, FooOverUDPEncapType,
"Failed to parse Encapsulation=");
static int netdev_fill_fou_tunnel_message(NetDev *netdev, sd_netlink_message **ret) {
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
@@ -94,12 +95,12 @@ static int netdev_fou_tunnel_verify(NetDev *netdev, const char *filename) {
assert(t);
if (t->fou_encap_type == NETDEV_FOO_OVER_UDP_ENCAP_DIRECT && t->fou_protocol <= 0) {
log_netdev_error(netdev, "FooOverUDP missing protocol configured in %s. Ignoring", filename);
log_netdev_error(netdev, "FooOverUDP protocol not configured in %s. Rejecting configuration.", filename);
return -EINVAL;
}
if (t->fou_encap_type == NETDEV_FOO_OVER_UDP_ENCAP_GUE && t->fou_protocol > 0) {
log_netdev_error(netdev, "FooOverUDP GUE can't be set with protocol configured in %s. Ignoring", filename);
log_netdev_error(netdev, "FooOverUDP GUE can't be set with protocol configured in %s. Rejecting configuration.", filename);
return -EINVAL;
}
+4 -3
View File
@@ -2924,7 +2924,7 @@ int get_product_uuid_handler(sd_bus_message *m, void *userdata, sd_bus_error *re
e = sd_bus_message_get_error(m);
if (e) {
log_error_errno(sd_bus_error_get_errno(e),
"Could not get product UUID. Fallback to use application specific machine ID as DUID-UUID: %s",
"Could not get product UUID. Falling back to use machine-app-specific ID as DUID-UUID: %s",
e->message);
goto configure;
}
@@ -2934,7 +2934,7 @@ int get_product_uuid_handler(sd_bus_message *m, void *userdata, sd_bus_error *re
goto configure;
if (sz != sizeof(sd_id128_t)) {
log_error("Invalid product UUID. Fallback to use application specific machine ID as DUID-UUID.");
log_error("Invalid product UUID. Falling back to use machine-app-specific ID as DUID-UUID.");
goto configure;
}
@@ -3006,7 +3006,8 @@ static int link_configure_duid(Link *link) {
if (r == -ENOMEM)
return r;
log_link_warning_errno(link, r, "Failed to get product UUID. Fallback to use application specific machine ID as DUID-UUID: %m");
log_link_warning_errno(link, r,
"Failed to get product UUID. Falling back to use machine-app-specific ID as DUID-UUID: %m");
return 1;
}
} else {
+9 -6
View File
@@ -434,7 +434,6 @@ static void test_getpeercred_getpeergroups(void) {
if (r == 0) {
static const gid_t gids[] = { 3, 4, 5, 6, 7 };
gid_t *test_gids;
_cleanup_free_ gid_t *peer_groups = NULL;
size_t n_test_gids;
uid_t test_uid;
gid_t test_gid;
@@ -475,12 +474,16 @@ static void test_getpeercred_getpeergroups(void) {
assert_se(ucred.gid == test_gid);
assert_se(ucred.pid == getpid_cached());
r = getpeergroups(pair[0], &peer_groups);
assert_se(r >= 0 || IN_SET(r, -EOPNOTSUPP, -ENOPROTOOPT));
{
_cleanup_free_ gid_t *peer_groups = NULL;
if (r >= 0) {
assert_se((size_t) r == n_test_gids);
assert_se(memcmp(peer_groups, test_gids, sizeof(gid_t) * n_test_gids) == 0);
r = getpeergroups(pair[0], &peer_groups);
assert_se(r >= 0 || IN_SET(r, -EOPNOTSUPP, -ENOPROTOOPT));
if (r >= 0) {
assert_se((size_t) r == n_test_gids);
assert_se(memcmp(peer_groups, test_gids, sizeof(gid_t) * n_test_gids) == 0);
}
}
safe_close_pair(pair);