You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Linux: Check return values of posix read/write
Fixes #29849, for real this time.
This commit is contained in:
@@ -159,11 +159,12 @@ int detect_prime() {
|
|||||||
if (!stat_loc) {
|
if (!stat_loc) {
|
||||||
// No need to do anything complicated here. Anything less than
|
// No need to do anything complicated here. Anything less than
|
||||||
// PIPE_BUF will be delivered in one read() call.
|
// PIPE_BUF will be delivered in one read() call.
|
||||||
read(fdset[0], string, sizeof(string) - 1);
|
// Leave it 'Unknown' otherwise.
|
||||||
|
if (read(fdset[0], string, sizeof(string) - 1) > 0) {
|
||||||
vendors[i] = string;
|
vendors[i] = string;
|
||||||
renderers[i] = string + strlen(string) + 1;
|
renderers[i] = string + strlen(string) + 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
close(fdset[0]);
|
close(fdset[0]);
|
||||||
|
|
||||||
@@ -190,8 +191,9 @@ int detect_prime() {
|
|||||||
memcpy(&string, vendor, vendor_len);
|
memcpy(&string, vendor, vendor_len);
|
||||||
memcpy(&string[vendor_len], renderer, renderer_len);
|
memcpy(&string[vendor_len], renderer, renderer_len);
|
||||||
|
|
||||||
write(fdset[1], string, vendor_len + renderer_len);
|
if (write(fdset[1], string, vendor_len + renderer_len) == -1) {
|
||||||
|
print_verbose("Couldn't write vendor/renderer string.");
|
||||||
|
}
|
||||||
close(fdset[1]);
|
close(fdset[1]);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -414,7 +414,9 @@ void JoypadLinux::joypad_vibration_start(int p_id, float p_weak_magnitude, float
|
|||||||
play.type = EV_FF;
|
play.type = EV_FF;
|
||||||
play.code = effect.id;
|
play.code = effect.id;
|
||||||
play.value = 1;
|
play.value = 1;
|
||||||
write(joy.fd, (const void *)&play, sizeof(play));
|
if (write(joy.fd, (const void *)&play, sizeof(play)) == -1) {
|
||||||
|
print_verbose("Couldn't write to Joypad device.");
|
||||||
|
}
|
||||||
|
|
||||||
joy.ff_effect_id = effect.id;
|
joy.ff_effect_id = effect.id;
|
||||||
joy.ff_effect_timestamp = p_timestamp;
|
joy.ff_effect_timestamp = p_timestamp;
|
||||||
|
|||||||
Reference in New Issue
Block a user