]> git.saurik.com Git - apt.git/commitdiff
tagfile: Hardcode error message for out of range integer values
authorJulian Andres Klode <jak@debian.org>
Mon, 14 Dec 2015 12:58:46 +0000 (13:58 +0100)
committerJulian Andres Klode <jak@debian.org>
Mon, 14 Dec 2015 12:58:46 +0000 (13:58 +0100)
This makes the test suite work on 32 bit-long platforms.

Gbp-Dch: ignore

apt-pkg/tagfile.cc
test/integration/test-policy-pinning

index 8acecd735f9da90642a3f2a29e0b3766c5295f97..2bef9b48b7dfc1c399d51e66220118900539f35b 100644 (file)
@@ -537,11 +537,10 @@ signed int pkgTagSection::FindI(const char *Tag,signed long Default) const
    errno = 0;
    char *End;
    signed long Result = strtol(S,&End,10);
-   if (errno == ERANGE)
-      _error->Errno("strtol", _("Cannot convert %s to integer"), S);
-   if (Result < std::numeric_limits<int>::min() || Result > std::numeric_limits<int>::max()) {
+   if (errno == ERANGE ||
+       Result < std::numeric_limits<int>::min() || Result > std::numeric_limits<int>::max()) {
       errno = ERANGE;
-      _error->Errno("", _("Cannot convert %s to integer"), S);
+      _error->Error(_("Cannot convert %s to integer: out of range"), S);
    }
    if (S == End)
       return Default;
index 062c8058f0e3525306a59ba78726bc1a712d6a4e..3d09cb7ce511bb329c9a754ae9e4322fa3cd17c4 100755 (executable)
@@ -302,7 +302,7 @@ Pin-Priority: 2147483648
 " > rootdir/etc/apt/preferences
 
 testfailureequal "Reading package lists...
-E: Cannot convert 2147483648 to integer -  (34: Numerical result out of range)
+E: Cannot convert 2147483648 to integer: out of range
 E: ${tmppath}/rootdir/etc/apt/preferences: Value 2147483648 is outside the range of valid pin priorities (-32768 to 32767)" \
  aptget install -s coolstuff -o PinPriority=2147483648