Root/
Source at commit 1406 created 12 years 10 months ago. By meklort, Revert drivers.c so that kexts are only loaded when OSBundleRequired is set and that value is not safe mode. Added some comments about it too. | |
---|---|
1 | /*␊ |
2 | * vfprintf.c␊ |
3 | */␊ |
4 | ␊ |
5 | #include <stdio.h>␊ |
6 | #include <string.h>␊ |
7 | #include <stdarg.h>␊ |
8 | #include <unistd.h>␊ |
9 | ␊ |
10 | #define BUFFER_SIZE␉32768␊ |
11 | ␊ |
12 | extern size_t _fwrite(const void *buf, size_t count, FILE *f);␊ |
13 | ␊ |
14 | int vfprintf(FILE * file, const char *format, va_list ap)␊ |
15 | {␊ |
16 | ␉int rv;␊ |
17 | ␉char buffer[BUFFER_SIZE];␊ |
18 | ␊ |
19 | ␉rv = vsnprintf(buffer, BUFFER_SIZE, format, ap);␊ |
20 | ␊ |
21 | ␉if (rv < 0)␊ |
22 | ␉␉return rv;␊ |
23 | ␊ |
24 | ␉if (rv > BUFFER_SIZE - 1)␊ |
25 | ␉␉rv = BUFFER_SIZE - 1;␊ |
26 | ␊ |
27 | ␉return _fwrite(buffer, rv, file);␊ |
28 | }␊ |
29 |