aboutsummaryrefslogtreecommitdiff
path: root/src/Hotplug.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-02-22 13:31:51 +0100
committerdec05eba <dec05eba@protonmail.com>2025-02-22 13:31:51 +0100
commit189736c1a96a1ad0e571ad69f01039e96455011a (patch)
tree22e1a78f698209e2ce0ef462a5d281b5b3030897 /src/Hotplug.cpp
parent8003c209fea16cd164817306cb33d46ac61a44f0 (diff)
Add option to take a screenshot (default hotkey: alt+f1)
Diffstat (limited to 'src/Hotplug.cpp')
-rw-r--r--src/Hotplug.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Hotplug.cpp b/src/Hotplug.cpp
index 84ed5bb..0f5155c 100644
--- a/src/Hotplug.cpp
+++ b/src/Hotplug.cpp
@@ -44,9 +44,10 @@ namespace gsr {
}
void Hotplug::process_event_data(int fd, const HotplugEventCallback &callback) {
- const int bytes_read = read(fd, event_data, sizeof(event_data));
+ const int bytes_read = read(fd, event_data, sizeof(event_data) - 1);
if(bytes_read <= 0)
return;
+ event_data[bytes_read] = '\0';
/* Hotplug data ends with a newline and a null terminator */
int data_index = 0;