if (!*str)
return -EINVAL;
errno = 0;
- if (sscanf(str, "%Ld%n", &v, &endidx) < 1)
+ if (sscanf(str, "%Li%n", &v, &endidx) < 1)
return -EINVAL;
if (str[endidx])
return -EINVAL;
continue;
}
if (strcmp(id, "ipc_perm") == 0) {
- char *perm;
- char *endp;
- err = snd_config_get_ascii(n, &perm);
+ long perm;
+ err = snd_config_get_integer(n, &perm);
if (err < 0) {
- SNDERR("The field ipc_perm must be a valid file permission");
+ SNDERR("Invalid type for %s", id);
return err;
}
- if (isdigit(*perm) == 0) {
+ if ((perm & ~0777) != 0) {
SNDERR("The field ipc_perm must be a valid file permission");
- free(perm);
return -EINVAL;
}
- rec->ipc_perm = strtol(perm, &endp, 8);
- free(perm);
+ rec->ipc_perm = perm;
continue;
}
if (strcmp(id, "ipc_gid") == 0) {
const char *fname = NULL, *ifname = NULL;
const char *format = NULL;
long fd = -1, ifd = -1;
- int perm = 0600;
+ long perm = 0600;
snd_config_for_each(i, next, conf) {
snd_config_t *n = snd_config_iterator_entry(i);
const char *id;
continue;
}
if (strcmp(id, "perm") == 0) {
- char *str;
- char *endp;
- err = snd_config_get_ascii(n, &str);
+ err = snd_config_get_integer(n, &perm);
if (err < 0) {
- SNDERR("The field perm must be a valid file permission");
+ SNDERR("Invalid type for %s", id);
return err;
}
- if (isdigit(*str) == 0) {
+ if ((perm & ~0777) != 0) {
SNDERR("The field perm must be a valid file permission");
- free(str);
return -EINVAL;
}
- perm = strtol(str, &endp, 8);
- free(str);
continue;
}
SNDERR("Unknown field %s", id);