size_t i;
for (i = 0; i < config_jump_table_size; i++)
- if (!strncmp(config_jump_table[i].name, key, strlen(config_jump_table[i].name)))
+ if (strnequal(config_jump_table[i].name, key, strlen(config_jump_table[i].name)))
return &config_jump_table[i];
return NULL;
if (ifa->ifa_addr->sa_family != AF_PACKET)
continue;
- if (!strncmp(value, ifa->ifa_name, strlen(value) - 1)) {
+ if (strnequal(value, ifa->ifa_name, strlen(value) - 1)) {
ret = set_config_net_type(type_key, tmpvalue, lxc_conf,
netdev);
if (!ret) {
if (lxc_config_value_empty(value))
return clr_config_seccomp_notify_proxy(key, lxc_conf, NULL);
- if (strncmp(value, "unix:", 5) != 0)
+ if (!strnequal(value, "unix:", 5))
return ret_set_errno(-1, EINVAL);
offset = value + 5;
return ret_errno(EINVAL);
}
- if (strncmp(key, token, token_len) != 0)
+ if (!strnequal(key, token, token_len))
return ret_errno(EINVAL);
subkey = key + token_len;
{
char *endptr = NULL;
- if (strncmp(*value, "unlimited", STRLITERALLEN("unlimited")) == 0) {
+ if (strnequal(*value, "unlimited", STRLITERALLEN("unlimited"))) {
*res = RLIM_INFINITY;
*value += STRLITERALLEN("unlimited");
return true;
if (lxc_config_value_empty(value))
return lxc_clear_limits(lxc_conf, key);
- if (strncmp(key, "lxc.prlimit.", STRLITERALLEN("lxc.prlimit.")) != 0)
+ if (!strnequal(key, "lxc.prlimit.", STRLITERALLEN("lxc.prlimit.")))
return ret_errno(EINVAL);
key += STRLITERALLEN("lxc.prlimit.");
if (lxc_config_value_empty(value))
return clr_config_sysctl(key, lxc_conf, NULL);
- if (strncmp(key, "lxc.sysctl.", STRLITERALLEN("lxc.sysctl.")) != 0)
+ if (!strnequal(key, "lxc.sysctl.", STRLITERALLEN("lxc.sysctl.")))
return -1;
key += STRLITERALLEN("lxc.sysctl.");
if (lxc_config_value_empty(value))
return clr_config_proc(key, lxc_conf, NULL);
- if (strncmp(key, "lxc.proc.", STRLITERALLEN("lxc.proc.")) != 0)
+ if (!strnequal(key, "lxc.proc.", STRLITERALLEN("lxc.proc.")))
return -1;
subkey = key + STRLITERALLEN("lxc.proc.");
break;
if (strequal("shmounts:", allowed_auto_mounts[i].token) &&
- strncmp("shmounts:", token, STRLITERALLEN("shmounts:")) == 0) {
+ strnequal("shmounts:", token, STRLITERALLEN("shmounts:"))) {
is_shmounts = true;
break;
}
continue;
len = strlen(fnam);
- if (len < 6 || strncmp(fnam + len - 5, ".conf", 5) != 0)
+ if (len < 6 || !strnequal(fnam + len - 5, ".conf", 5))
continue;
len = strnprintf(path, sizeof(path), "%s/%s", dirp, fnam);
return 0;
/* martian option - don't add it to the config itself */
- if (strncmp(line, "lxc.", 4))
+ if (!strnequal(line, "lxc.", 4))
return 0;
dot = strchr(line, '=');
line += lxc_char_left_gc(line, strlen(line));
/* martian option - don't add it to the config itself */
- if (strncmp(line, "lxc.", 4))
+ if (!strnequal(line, "lxc.", 4))
return 0;
dot = strchr(line, '=');
else
lend++;
- if (strncmp(lstart, key, strlen(key)) != 0) {
+ if (!strnequal(lstart, key, strlen(key))) {
lstart = lend;
continue;
}
else
lend++;
- if (strncmp(lstart, key, strlen(key)) != 0)
+ if (!strnequal(lstart, key, strlen(key)))
goto next;
p = strchr(lstart + strlen(key), '=');
else
lend++;
- if (strncmp(lstart, key, strlen(key)) != 0)
+ if (!strnequal(lstart, key, strlen(key)))
goto next;
p = strchr(lstart + strlen(key), '=');
if (p >= lend)
goto next;
- if (strncmp(p, olddir, strlen(olddir)) != 0)
+ if (!strnequal(p, olddir, strlen(olddir)))
goto next;
/* replace the olddir with newdir */
if (strequal(key, global_token))
get_all = true;
- else if (strncmp(key, namespaced_token, namespaced_token_len) == 0)
+ else if (strnequal(key, namespaced_token, namespaced_token_len))
key += namespaced_token_len;
else
return ret_errno(EINVAL);
if (strequal(key, "lxc.prlimit"))
get_all = true;
- else if (strncmp(key, "lxc.prlimit.", 12) == 0)
+ else if (strnequal(key, "lxc.prlimit.", 12))
key += 12;
else
return ret_errno(EINVAL);
if (strequal(key, "lxc.sysctl"))
get_all = true;
- else if (strncmp(key, "lxc.sysctl.", STRLITERALLEN("lxc.sysctl.")) == 0)
+ else if (strnequal(key, "lxc.sysctl.", STRLITERALLEN("lxc.sysctl.")))
key += STRLITERALLEN("lxc.sysctl.");
else
return ret_errno(EINVAL);
if (strequal(key, "lxc.proc"))
get_all = true;
- else if (strncmp(key, "lxc.proc.", STRLITERALLEN("lxc.proc.")) == 0)
+ else if (strnequal(key, "lxc.proc.", STRLITERALLEN("lxc.proc.")))
key += STRLITERALLEN("lxc.proc.");
else
return ret_errno(EINVAL);
char *idx_start, *idx_end;
/* check that this is a sensible network key */
- if (strncmp("lxc.net.", key, 8))
+ if (!strnequal("lxc.net.", key, 8))
return log_error_errno(NULL, EINVAL, "Invalid network configuration key \"%s\"", key);
copy = strdup(key);