While at it, constify the argument.
#include "resolved-dnssd-bus.h"
#include "resolved-dnssd.h"
#include "resolved-link-bus.h"
+#include "stdio-util.h"
#include "user-util.h"
#include "utf8.h"
rc = dns_rcode_to_string(q->answer_rcode);
if (!rc) {
- sprintf(p, "%i", q->answer_rcode);
+ xsprintf(p, "%i", q->answer_rcode);
rc = p;
}
#include "resolved-bus.h"
#include "resolved-link-bus.h"
#include "resolved-resolv-conf.h"
+#include "stdio-util.h"
#include "strv.h"
#include "user-util.h"
return 1;
}
-char *link_bus_path(Link *link) {
- _cleanup_free_ char *ifindex = NULL;
- char *p;
+char *link_bus_path(const Link *link) {
+ char *p, ifindex[DECIMAL_STR_MAX(link->ifindex)];
int r;
assert(link);
- if (asprintf(&ifindex, "%i", link->ifindex) < 0)
- return NULL;
+ xsprintf(ifindex, "%i", link->ifindex);
r = sd_bus_path_encode("/org/freedesktop/resolve1/link", ifindex, &p);
if (r < 0)
extern const sd_bus_vtable link_vtable[];
int link_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error);
-char *link_bus_path(Link *link);
+char *link_bus_path(const Link *link);
int link_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error);
int bus_link_method_set_dns_servers(sd_bus_message *message, void *userdata, sd_bus_error *error);
}
int manager_write_resolv_conf(Manager *m) {
-
_cleanup_ordered_set_free_ OrderedSet *dns = NULL, *domains = NULL;
_cleanup_free_ char *temp_path_uplink = NULL, *temp_path_stub = NULL;
_cleanup_fclose_ FILE *f_uplink = NULL, *f_stub = NULL;