smalloc: print debug info on oom error
[fio.git] / lib / strntol.c
index 713f63bb0c683201f61b545f6ba7386f3dc19055..c3a55a117801f56fbe39a40e9b09327968cbc3e0 100644 (file)
@@ -2,6 +2,8 @@
 #include <stdlib.h>
 #include <limits.h>
 
+#include "strntol.h"
+
 long strntol(const char *str, size_t sz, char **end, int base)
 {
        /* Expect that digit representation of LONG_MAX/MIN
@@ -26,6 +28,6 @@ long strntol(const char *str, size_t sz, char **end, int base)
        if (ret == LONG_MIN || ret == LONG_MAX)
                return ret;
        if (end)
-               *end = (char *)str + (*end - buf);
+               *end = (char *)beg + (*end - buf);
        return ret;
 }