diff -uNr sleepd-2.05.orig/acpi.c sleepd-2.05/acpi.c --- sleepd-2.05.orig/acpi.c 2014-05-28 04:06:50.000000000 +0800 +++ sleepd-2.05/acpi.c 2020-07-17 22:51:39.340113991 +0800 @@ -67,7 +67,7 @@ fd = open(file, O_RDONLY); if (fd == -1) return NULL; end = read(fd, buf, sizeof(buf)); - buf[end-1] = '\0'; + ((buf[end-1]) == '\n') && (buf[end-1] = '\0'); close(fd); return buf; }