chiark / gitweb /
Make run_directory.c stat the place it is going to try to run.
[elogind.git] / klibc / klibc / asprintf.c
index 457d34bb15c147358e0e3a7e1c2a35c7256d707d..6002b576e1ac3615efec7d6062f6a14437ab1a48 100644 (file)
@@ -16,10 +16,10 @@ int asprintf(char **bufp, const char *format, ...)
   va_start(ap, format);
   va_copy(ap1, ap);
 
-  bytes = vsnprintf(NULL, 0, format, ap1);
+  bytes = vsnprintf(NULL, 0, format, ap1) + 1;
   va_end(ap1);
 
-  *bufp = p = malloc(bytes+1);
+  *bufp = p = malloc(bytes);
   if ( !p )
     return -1;