fixed (?) _write function

This commit is contained in:
georgemoralis 2024-03-31 18:04:11 +03:00
parent a21722a1db
commit 03b3194c44

View file

@ -3,6 +3,7 @@
// Generated By moduleGenerator // Generated By moduleGenerator
#include <common/assert.h> #include <common/assert.h>
#include <string.h>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "error_codes.h" #include "error_codes.h"
#include "libkernel.h" #include "libkernel.h"
@ -462,7 +463,11 @@ int PS4_SYSV_ABI _wait4() {
*/ */
s64 PS4_SYSV_ABI ps4__write(int d, const void* buf, std::size_t nbytes) { s64 PS4_SYSV_ABI ps4__write(int d, const void* buf, std::size_t nbytes) {
if (d <= 2) { // stdin,stdout,stderr if (d <= 2) { // stdin,stdout,stderr
LOG_INFO(Kernel, "{}", (const char*)buf); char* str = strdup((const char*)buf);
if (str[nbytes - 1] == '\n')
str[nbytes - 1] = 0;
LOG_INFO(Kernel, "{}", str);
free(str);
return nbytes; return nbytes;
} }
LOG_ERROR(Kernel, "(STUBBED) called d = {} nbytes = {} ", d, nbytes); LOG_ERROR(Kernel, "(STUBBED) called d = {} nbytes = {} ", d, nbytes);