Skip to contentSkip to conversation

master - cleanup: libdm simplier error comparation

PATCH Zdenek Kabelac 1 participant 1 message Jul 2, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=748af97afc30d65a9b89d877fdbd2e12ea8fb8e3
Commit:        748af97afc30d65a9b89d877fdbd2e12ea8fb8e3
Parent:        e21d0eb90e9a842ca5fd4d09c076f5fb894ba6ca
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Wed Jul 2 00:00:31 2014 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Jul 2 10:45:42 2014 +0200

cleanup: libdm simplier error comparation

When testing return value from snprintf
use simplier form '>=' instead of '+1 >'.

---
 libdm/libdm-string.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
libdm/libdm-string.c +1 -1
index 8ad479c..bc41b70 100644
@@ -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;