lib/vsprintf.c: fix handling of %zd when using ssize_t
[~shefty/rdma-dev.git] / lib / vsprintf.c
index 39c99fea7c0386f5cb12cfe814085d182d9c4db9..41da0741a663a0b62150c640979657fde51b143e 100644 (file)
@@ -1485,7 +1485,10 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
                                num = va_arg(args, long);
                                break;
                        case FORMAT_TYPE_SIZE_T:
-                               num = va_arg(args, size_t);
+                               if (spec.flags & SIGN)
+                                       num = va_arg(args, ssize_t);
+                               else
+                                       num = va_arg(args, size_t);
                                break;
                        case FORMAT_TYPE_PTRDIFF:
                                num = va_arg(args, ptrdiff_t);