summaryrefslogtreecommitdiff
path: root/utils/start-stop-daemon.c
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2018-10-12 13:26:32 +0200
committerGuillem Jover <guillem@debian.org>2019-01-15 04:49:02 +0100
commitf47ab454d1eb51cb2302172899847064541158da (patch)
tree9b721dffb529a187fb91edc98285d18d6cdf1b02 /utils/start-stop-daemon.c
parent4e5d1cc751d5a9c399f62f59e0ca2da27a37c4c4 (diff)
downloaddpkg-f47ab454d1eb51cb2302172899847064541158da.tar.gz
s-s-d: Move parse_unsigned() definition to the top of the file
This way we can use in earlier functions.
Diffstat (limited to 'utils/start-stop-daemon.c')
-rw-r--r--utils/start-stop-daemon.c40
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)