Skip to content

Commit

Permalink
replace manual open+stat with sanctum_file_open
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvink committed Feb 2, 2025
1 parent a42ea0c commit 54ab841
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/cathedral.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,18 +932,8 @@ cathedral_settings_reload(void)
if (sanctum->settings == NULL)
return;

if ((fd = open(sanctum->settings, O_RDONLY)) == -1) {
sanctum_log(LOG_NOTICE, "failed to open '%s': %s",
sanctum->settings, errno_s);
if ((fd = sanctum_file_open(sanctum->settings, &st)) == -1)
return;
}

if (fstat(fd, &st) == -1) {
sanctum_log(LOG_NOTICE, "failed to fstat '%s': %s",
sanctum->settings, errno_s);
(void)close(fd);
return;
}

if (st.st_mtime == settings_last_mtime) {
(void)close(fd);
Expand Down

0 comments on commit 54ab841

Please sign in to comment.