acpid/acpid-1.0.4-skip-editor-backup-files.diff

21 lines
637 B
Diff

Ignore files ending in '~' when searching for event config files.
Fixes https://sourceforge.net/tracker/index.php?func=detail&aid=1530974&group_id=33140&atid=407341
From: Stefan Seyfried <seife@suse.de>
--- event.c
+++ event.c
@@ -121,7 +121,11 @@
if (dirent->d_name[0] == '.')
continue; /* skip dotfiles */
- len = strlen(dirent->d_name) + strlen(confdir) + 2;
+ len = strlen(dirent->d_name);
+ if (len > 0 && dirent->d_name[len - 1] == '~')
+ continue; /* skip editor backup files */
+
+ len += strlen(confdir) + 2;
file = (char *)malloc(len);
if (!file) {
acpid_log("ERR: malloc(): %s\n", strerror(errno));