aboutsummaryrefslogtreecommitdiff
path: root/tools/gsr-global-hotkeys/hotplug.c
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 /tools/gsr-global-hotkeys/hotplug.c
parent8003c209fea16cd164817306cb33d46ac61a44f0 (diff)
Add option to take a screenshot (default hotkey: alt+f1)
Diffstat (limited to 'tools/gsr-global-hotkeys/hotplug.c')
-rw-r--r--tools/gsr-global-hotkeys/hotplug.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/gsr-global-hotkeys/hotplug.c b/tools/gsr-global-hotkeys/hotplug.c
index 5ea2978..2e8ca9f 100644
--- a/tools/gsr-global-hotkeys/hotplug.c
+++ b/tools/gsr-global-hotkeys/hotplug.c
@@ -65,9 +65,10 @@ static void hotplug_event_parse_netlink_data(hotplug_event *self, const char *li
/* Netlink uevent structure is documented here: https://web.archive.org/web/20160127215232/https://www.kernel.org/doc/pending/hotplug.txt */
void hotplug_event_process_event_data(hotplug_event *self, int fd, hotplug_device_added_callback callback, void *userdata) {
- const int bytes_read = read(fd, self->event_data, sizeof(self->event_data));
+ const int bytes_read = read(fd, self->event_data, sizeof(self->event_data) - 1);
if(bytes_read <= 0)
return;
+ self->event_data[bytes_read] = '\0';
/* Hotplug data ends with a newline and a null terminator */
int data_index = 0;