From 748af97afc30d65a9b89d877fdbd2e12ea8fb8e3 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 2 Jul 2014 00:00:31 +0200 Subject: [PATCH] cleanup: libdm simplier error comparation When testing return value from snprintf use simplier form '>=' instead of '+1 >'. --- libdm/libdm-string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdm/libdm-string.c b/libdm/libdm-string.c index 8ad479cd2..bc41b7042 100644 --- a/libdm/libdm-string.c +++ b/libdm/libdm-string.c @@ -122,7 +122,7 @@ int dm_snprintf(char *buf, size_t bufsize, const char *format, ...) n = vsnprintf(buf, bufsize, format, ap); va_end(ap); - if (n < 0 || ((unsigned) n + 1 > bufsize)) + if (n < 0 || ((unsigned) n >= bufsize)) return -1; return n;