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) 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;
} }
} }
if (fputc(*format, file) == EOF) else
return -1; {
written++; if (fputc(*format, file) == EOF)
format++; return -1;
written++;
format++;
}
} }
return written; return written;
} }