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

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=2b771a88ea8d66fd63acf73f93e5d0e486652982

commit 2b771a88ea8d66fd63acf73f93e5d0e486652982
Author: Guillem Jover <[email protected]>
AuthorDate: Thu Apr 25 23:02:31 2024 +0200

    src: Fix timestamp parse error reporting
    
    We should distinguish between errors causing errno to be set, and errors
    from partial conversions or no conversions at all. Otherwise we might
    get an error message that states "Success" which is more confusing than
    helpful.
    
    Ref: #1069846
---
 src/deb/build.c   | 4 +++-
 src/split/split.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/deb/build.c b/src/deb/build.c
index 1f0c050ee..aaf3f509c 100644
--- a/src/deb/build.c
+++ b/src/deb/build.c
@@ -544,7 +544,9 @@ parse_timestamp(const char *value)
 
   errno = 0;
   timestamp = strtoimax(value, &end, 10);
-  if (value == end || *end || errno != 0)
+  if (value == end || *end)
+    ohshit(_("unable to parse timestamp '%.255s'"), value);
+  else if (errno != 0)
     ohshite(_("unable to parse timestamp '%.255s'"), value);
 
   return timestamp;
diff --git a/src/split/split.c b/src/split/split.c
index 771de626c..a738d323e 100644
--- a/src/split/split.c
+++ b/src/split/split.c
@@ -99,7 +99,9 @@ parse_timestamp(const char *value)
 
        errno = 0;
        timestamp = strtoimax(value, &end, 10);
-       if (value == end || *end || errno != 0)
+       if (value == end || *end)
+               ohshit(_("unable to parse timestamp '%.255s'"), value);
+       else if (errno != 0)
                ohshite(_("unable to parse timestamp '%.255s'"), value);
 
        return timestamp;

-- 
Dpkg.Org's dpkg

Reply via email to