aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Miciah Masters <miciah.masters@gmail.com>2016-12-24 03:27:09 -0500
committerGravatar Miciah Dashiel Butler Masters <mmasters@redhat.com>2017-01-15 01:59:49 -0500
commit0a6ee486b4a1171adc0fde02a880f99d5d9a2ebb (patch)
tree0c0a142fd9defa3901794ae5ee1bf86a20855a9c /Makefile
parent8d17af9cc111d50a8b0be9ff2f35a9b333290781 (diff)
Fix logic for directory creation when saving state
When creating the /tmp/brightnessctl directory or its subdirectories, clear errno before calling mkdir, and call stat a second time after mkdir. Previously, errno was not cleared, so even if the error was handled (by creating the missing directory with mkdir), subsequent error handling code read the old errno value from the failed stat call and printed an error message. Additionally, because we did not call stat again after calling mkdir, the stat buffer had outdated information, and so S_ISDIR returned a false negative. As a result of these defects, invoking brightnessctl -s when /tmp/brightnessctl did not exist would create /tmp/brightnessctl and fail. Invoking brightnessctl -s a second time would create /tmp/brightnessctl/backlight and fail. Invoking the command a third time would succeed and write the state file under /tmp/brightnessctl/backlight/. After this commit, brightnessctl -s succeeds the first time.
Diffstat (limited to 'Makefile')
0 files changed, 0 insertions, 0 deletions