mss-myhostname wasn't working because of underlinking. Instead of
fixing the underlinking, just remove the use of _cleanup_ macros.
It is impolite to use our utility functions in modules designed to be
loaded by others. So cleanup macros which (at some point) call assert
which calls log_assert_failed, should not be used. Revert this part of
commit
d73c3269c.
#include <stdlib.h>
#include "ifconf.h"
#include <stdlib.h>
#include "ifconf.h"
-#include "macro.h"
-#include "util.h"
int r, on = 1;
struct address *list = NULL;
unsigned n_list = 0;
int r, on = 1;
struct address *list = NULL;
unsigned n_list = 0;
- int _cleanup_close_ fd;
fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
if (fd < 0)
return -errno;
fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
if (fd < 0)
return -errno;
- if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0)
- return -errno;
+ if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) {
+ r = -errno;
+ goto finish;
+ }
- if (send(fd, &req, req.hdr.nlmsg_len, 0) < 0)
- return -errno;
+ if (send(fd, &req, req.hdr.nlmsg_len, 0) < 0) {
+ r = -errno;
+ goto finish;
+ }
while((r = read_reply(fd, &list, &n_list)) == 0)
;
while((r = read_reply(fd, &list, &n_list)) == 0)
;
if (r < 0) {
free(list);
return r;
}
if (r < 0) {
free(list);
return r;
}
- assert(n_list == 0 || list);
qsort(list, n_list, sizeof(struct address), address_compare);
*_list = list;
qsort(list, n_list, sizeof(struct address), address_compare);
*_list = list;