diff options
Diffstat (limited to 'utils/start-stop-daemon.c')
-rw-r--r-- | utils/start-stop-daemon.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c index 63fee7e4d..63fb36a7d 100644 --- a/utils/start-stop-daemon.c +++ b/utils/start-stop-daemon.c @@ -436,6 +436,26 @@ newpath(const char *dirname, const char *filename) return path; } +static int +parse_unsigned(const char *string, int base, int *value_r) +{ + long value; + char *endptr; + + if (!string[0]) + return -1; + + errno = 0; + value = strtol(string, &endptr, base); + if (string == endptr || *endptr != '\0' || errno != 0) + return -1; + if (value < 0 || value > INT_MAX) + return -1; + + *value_r = value; + return 0; +} + static long get_open_fd_max(void) { @@ -745,26 +765,6 @@ static const struct sigpair siglist[] = { }; static int -parse_unsigned(const char *string, int base, int *value_r) -{ - long value; - char *endptr; - - if (!string[0]) - return -1; - - errno = 0; - value = strtol(string, &endptr, base); - if (string == endptr || *endptr != '\0' || errno != 0) - return -1; - if (value < 0 || value > INT_MAX) - return -1; - - *value_r = value; - return 0; -} - -static int parse_pid(const char *pid_str, int *pid_num) { if (parse_unsigned(pid_str, 10, pid_num) != 0) |