blob: a529d383c056f818c7e48cd5606ba8715a9a65bc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include <stdlib.h>
#include <errno.h>
#include "util.h"
int libfuse_strtol(const char *str, long *res)
{
char *endptr;
int base = 10;
long val;
errno = 0;
if (!str)
return -EINVAL;
val = strtol(str, &endptr, base);
if (errno)
return -errno;
if (endptr == str || *endptr != '\0')
return -EINVAL;
*res = val;
return 0;
}
|