diff options
author | Topi Miettinen <toiwoton@gmail.com> | 2019-01-31 18:07:06 +0100 |
---|---|---|
committer | Topi Miettinen <toiwoton@gmail.com> | 2019-02-02 15:25:32 +0100 |
commit | cbed254f9673256836554b0b6e16941747f925f8 (patch) | |
tree | 56773dfb0af9c41e657f503f882492b24a934880 /src/backlight | |
parent | basic: change read_one_line_file() to return number of bytes read (diff) | |
download | systemd-cbed254f9673256836554b0b6e16941747f925f8.tar.xz systemd-cbed254f9673256836554b0b6e16941747f925f8.zip |
backlight: handle loading truncated file
I had accidentally filled my /var partition. This caused backlight to fail to
start even with disk space, because the brightness files were truncated to zero
size:
systemd-backlight[624]: acpi_video0: Failed to parse brightness "": Invalid argument
systemd-backlight[624]: acpi_video0: Failed to write system 'brightness' attribute: No such device or address
systemd[1]: systemd-backlight@backlight:acpi_video0.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: systemd-backlight@backlight:acpi_video0.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Load/Save Screen Backlight Brightness of backlight:acpi_video0.
Handle a truncated file like non-existent file.
Diffstat (limited to 'src/backlight')
-rw-r--r-- | src/backlight/backlight.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c index 780ad56eb1..2fcc693c48 100644 --- a/src/backlight/backlight.c +++ b/src/backlight/backlight.c @@ -379,7 +379,7 @@ static int run(int argc, char *argv[]) { clamp = shall_clamp(device); r = read_one_line_file(saved, &value); - if (r == -ENOENT) { + if (IN_SET(r, -ENOENT, 0)) { const char *curval; /* Fallback to clamping current brightness or exit early if |