LibC: Fix bug in *printf

This commit is contained in:
Bananymous 2023-05-09 20:30:12 +03:00
parent 512be884ed
commit 0cc1fb53d5
1 changed files with 12 additions and 4 deletions

View File

@ -462,6 +462,10 @@ int vfprintf(FILE* file, const char* format, va_list arguments)
switch (*format)
{
case '%':
if (fputc('%', file) == EOF)
return -1;
written++;
format++;
break;
case 's':
{
@ -476,11 +480,15 @@ int vfprintf(FILE* file, const char* format, va_list arguments)
break;
}
}
if (fputc(*format, file) == EOF)
return -1;
written++;
format++;
else
{
if (fputc(*format, file) == EOF)
return -1;
written++;
format++;
}
}
return written;
}