all: fix conditional build

There were bad code changes that cause the compiler to complain or
panic, but went unnoticed since they are only built if toggled with
`--enable-xxx` or `--disable-xxx` during build configuration.

Fix them altogether.
This commit is contained in:
CismonX 2025-02-08 19:47:20 +08:00
parent d1dac54b72
commit df29392008
No known key found for this signature in database
GPG key ID: 3094873E29A482FB
3 changed files with 13 additions and 14 deletions

View file

@ -1693,7 +1693,7 @@ backend_create (
struct bookmarkfs_backend_create_resp *resp
) {
#ifndef BOOKMARKFS_BACKEND_CHROMIUM_WRITE
if (!(conf->flags & BOOKMARKFS_READONLY)) {
if (!(conf->flags & BOOKMARKFS_BACKEND_READONLY)) {
log_puts("write support is not enabled on this build");
return -1;
}

View file

@ -57,6 +57,7 @@ static int expect_input (struct handler_ctx *, char **);
static int expect_next (struct handler_ctx *, int, char **);
static int handle_input (struct handler_ctx *,
union bookmarkfs_fsck_handler_data *);
static void print_entry (struct bookmarkfs_fsck_data const *);
static void print_usage (void);
#endif /* defined(BOOKMARKFS_INTERACTIVE_FSCK) */
@ -67,7 +68,6 @@ static int handle_entry (struct handler_ctx *, enum bookmarkfs_fsck_result,
union bookmarkfs_fsck_handler_data *);
static int parse_opts (struct bookmarkfs_conf_opt const *,
struct parsed_opts *);
static void print_entry (struct bookmarkfs_fsck_data const *);
// Forward declaration end
#ifdef BOOKMARKFS_INTERACTIVE_FSCK
@ -185,6 +185,16 @@ handle_input (
return control;
}
static void
print_entry (
struct bookmarkfs_fsck_data const *data
) {
char name_buf[sizeof(data->name)];
escape_control_chars(name_buf, sizeof(name_buf), data->name, '?');
printf("id: %" PRIu64 "\nname: %s\n", data->id, name_buf);
}
static void
print_usage (void)
{
@ -319,16 +329,6 @@ parse_opts (
return 0;
}
static void
print_entry (
struct bookmarkfs_fsck_data const *data
) {
char name_buf[sizeof(data->name)];
escape_control_chars(name_buf, sizeof(name_buf), data->name, '?');
printf("id: %" PRIu64 "\nname: %s\n", data->id, name_buf);
}
static int
fsck_handler_create (
struct bookmarkfs_conf_opt const *opts,

View file

@ -333,7 +333,7 @@ sandbox_enter (
close(lrfd);
#else
log_printf("landlock is not supported on this build");
log_puts("landlock is not supported on this build");
#endif /* defined(BOOKMARKFS_SANDBOX_LANDLOCK) */
if (status < 0) {
@ -401,7 +401,6 @@ sandbox_enter (
int
sandbox_enter (
int UNUSED_VAR(fusefd),
int UNUSED_VAR(dirfd),
uint32_t flags
) {