bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] ntoab: Handle LONG_MIN case.


From: Danny Milosavljevic
Subject: [PATCH] ntoab: Handle LONG_MIN case.
Date: Tue, 2 Jun 2020 00:43:52 +0200

* lib/mes/ntoab.c (ntoab): Handle LONG_MIN case.
---
 lib/mes/ntoab.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/mes/ntoab.c b/lib/mes/ntoab.c
index ce91c73a..382e2326 100644
--- a/lib/mes/ntoab.c
+++ b/lib/mes/ntoab.c
@@ -20,10 +20,16 @@
 
 #include <assert.h>
 #include <mes/lib.h>
+#include <stdint.h>
+
+#define STR(x) #x
+#define XSTR(s) STR(s)
 
 char *
 ntoab (long x, int base, int signed_p)
 {
+  if (x == LONG_MIN && base == 10)
+    return XSTR(LONG_MIN);
   static char itoa_buf[20];
   char *p = itoa_buf + 11;
   *p-- = 0;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]