]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - string.c
play.c: Remove bogus __a_unused attribute for session_open().
[paraslash.git] / string.c
index f8b64b77c08d0c109c62129bdfeac04b775b3d6b..c35285153fdadf031fafb544aea4affdf066a86d 100644 (file)
--- a/string.c
+++ b/string.c
@@ -562,10 +562,18 @@ int para_atoi64(const char *str, int64_t *value)
        tmp = strtoll(str, &endptr, 10);
        if (errno == ERANGE && (tmp == LLONG_MAX || tmp == LLONG_MIN))
                return -E_ATOI_OVERFLOW;
-       if (errno != 0 && tmp == 0) /* other error */
-               return -E_STRTOLL;
+       /*
+        * If there were no digits at all, strtoll() stores the original value
+        * of str in *endptr.
+        */
        if (endptr == str)
                return -E_ATOI_NO_DIGITS;
+       /*
+        * The implementation may also set errno and return 0 in case no
+        * conversion was performed.
+        */
+       if (errno != 0 && tmp == 0)
+               return -E_ATOI_NO_DIGITS;
        if (*endptr != '\0') /* Further characters after number */
                return -E_ATOI_JUNK_AT_END;
        *value = tmp;