Skip to content
Myr

cache: fix incorrect cache write error message

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The error message when failing to open the cache file for writing was incorrect on user-specified values (either CLI flag `--cache=...` or `fuzzel.ini` configuration `cache=...`).

authored by Nicholas Rodrigues Lordello · committed by Daniel Eklöf · parent 57d4ac5 · Browse files · 1 file+9 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−7 removed

  • other:+9 added−7 removed

1 file+9 added−7 removed

modified:main.c+9 added-7 removed
236 unmodified lines
237 LOG_ERRNO("%s: failed to open", path);238 return;239 }240241 fd = openat(cache_dir_fd, "fuzzel", O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);241 if ((fd = openat(cache_dir_fd, "fuzzel", O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644)) == -1) {242 close(cache_dir_fd);243 LOG_ERRNO("%s/fuzzel: failed to open", path);244 return;245 }246 close(cache_dir_fd);247 } else {244 fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);248 if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644)) == -1) {249 LOG_ERRNO("%s: failed to open", path);250 return;251 }252 }253247 if (fd == -1) {248 LOG_ERRNO("%s/fuzzel: failed to open", path);249 return;250 }251254 for (size_t i = 0; i < apps->count; i++) {255 if (apps->v[i]->count == 0)256 continue;257
2195 unmodified lines