diff options
Diffstat (limited to 'extensions/libxt_set.h')
-rw-r--r-- | extensions/libxt_set.h | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/extensions/libxt_set.h b/extensions/libxt_set.h index 41dfbd30..b7de4cc4 100644 --- a/extensions/libxt_set.h +++ b/extensions/libxt_set.h @@ -6,12 +6,11 @@ #include <sys/types.h> #include <sys/socket.h> #include <errno.h> -#include "../iptables/xshared.h" static int get_version(unsigned *version) { - int res, sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); + int res, sockfd = socket(AF_INET, SOCK_RAW | SOCK_CLOEXEC, IPPROTO_RAW); struct ip_set_req_version req_version; socklen_t size = sizeof(req_version); @@ -19,12 +18,6 @@ get_version(unsigned *version) xtables_error(OTHER_PROBLEM, "Can't open socket to ipset.\n"); - if (fcntl(sockfd, F_SETFD, FD_CLOEXEC) == -1) { - xtables_error(OTHER_PROBLEM, - "Could not set close on exec: %s\n", - strerror(errno)); - } - req_version.op = IP_SET_OP_VERSION; res = getsockopt(sockfd, SOL_IP, SO_IP_SET, &req_version, &size); if (res != 0) @@ -141,7 +134,7 @@ get_set_byname(const char *setname, struct xt_set_info *info) static void parse_dirs_v0(const char *opt_arg, struct xt_set_info_v0 *info) { - char *saved = strdup(opt_arg); + char *saved = xtables_strdup(opt_arg); char *ptr, *tmp = saved; int i = 0; @@ -153,7 +146,7 @@ parse_dirs_v0(const char *opt_arg, struct xt_set_info_v0 *info) info->u.flags[i++] |= IPSET_DST; else xtables_error(PARAMETER_PROBLEM, - "You must spefify (the comma separated list of) 'src' or 'dst'."); + "You must specify (the comma separated list of) 'src' or 'dst'."); } if (tmp) @@ -167,7 +160,7 @@ parse_dirs_v0(const char *opt_arg, struct xt_set_info_v0 *info) static void parse_dirs(const char *opt_arg, struct xt_set_info *info) { - char *saved = strdup(opt_arg); + char *saved = xtables_strdup(opt_arg); char *ptr, *tmp = saved; while (info->dim < IPSET_DIM_MAX && tmp != NULL) { @@ -177,7 +170,7 @@ parse_dirs(const char *opt_arg, struct xt_set_info *info) info->flags |= (1 << info->dim); else if (strncmp(ptr, "dst", 3) != 0) xtables_error(PARAMETER_PROBLEM, - "You must spefify (the comma separated list of) 'src' or 'dst'."); + "You must specify (the comma separated list of) 'src' or 'dst'."); } if (tmp) |