This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=090c1a51040557c0361776ed7bf297722dbfd4b3

commit 090c1a51040557c0361776ed7bf297722dbfd4b3
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Feb 15 04:43:33 2019 +0100

    s-s-d: Make sure that we get a meaningful errno on parse_unsigned()
    
    Initialize errno to 0 before returning on any error condition, not just
    before strtol(3), so that when we call fatal() we get a meaningful value
    in errno.
---
 debian/changelog          | 2 ++
 utils/start-stop-daemon.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 6d95110ae..e2f7bd67d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
 dpkg (1.19.5) UNRELEASED; urgency=medium
 
   [ Guillem Jover ]
+  * start-stop-daemon: Make sure that we get a meaningful errno on
+    parse_unsigned(), so that the error messages always make sense.
   * Build system:
     - Check whether this dist is a release, based only on the version format.
       This will avoid having to do a two staged release to get a proper perl
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 7a52643f8..035ee0306 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -448,10 +448,10 @@ parse_unsigned(const char *string, int base, int *value_r)
        long value;
        char *endptr;
 
+       errno = 0;
        if (!string[0])
                return -1;
 
-       errno = 0;
        value = strtol(string, &endptr, base);
        if (string == endptr || *endptr != '\0' || errno != 0)
                return -1;

-- 
Dpkg.Org's dpkg

Reply via email to