LibC: Fix bug in *printf

This commit is contained in:
Bananymous 2023-05-09 20:30:12 +03:00
parent 812e61ca70
commit 5248a3fe48
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) switch (*format)
{ {
case '%': case '%':
if (fputc('%', file) == EOF)
return -1;
written++;
format++;
break; break;
case 's': case 's':
{ {
@ -476,11 +480,15 @@ int vfprintf(FILE* file, const char* format, va_list arguments)
break; break;
} }
} }
else
{
if (fputc(*format, file) == EOF) if (fputc(*format, file) == EOF)
return -1; return -1;
written++; written++;
format++; format++;
} }
}
return written; return written;
} }