aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2023-11-20 17:21:48 +0100
committerSebastian Pipping <sebastian@pipping.org>2023-11-20 18:36:08 +0100
commit9d5b333fb6e548aa2a9cda9094ad7e96e3eb33f7 (patch)
tree014d5a8d1de974ee2e07b9db67477df8d3a0adfb /src
parent9cc4a6928da3931d0d7d6afad4489384cb21de23 (diff)
downloadbindfs-9d5b333fb6e548aa2a9cda9094ad7e96e3eb33f7.tar.gz
src|tests: Address warning -Wstrict-prototypes
Symptom with Clang 15: > In file included from userinfo.c:20: > ./userinfo.h:38:27: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] > void invalidate_user_cache(); /* safe to call from signal handler */ > ^ > void > [many more]
Diffstat (limited to 'src')
-rw-r--r--src/bindfs.c24
-rw-r--r--src/permchain.c2
-rw-r--r--src/permchain.h2
-rw-r--r--src/rate_limiter.c4
-rw-r--r--src/rate_limiter.h6
-rw-r--r--src/userinfo.c22
-rw-r--r--src/userinfo.h2
-rw-r--r--src/usermap.c2
-rw-r--r--src/usermap.h2
9 files changed, 33 insertions, 33 deletions
diff --git a/src/bindfs.c b/src/bindfs.c
index 72f11ec..1071778 100644
--- a/src/bindfs.c
+++ b/src/bindfs.c
@@ -225,7 +225,7 @@ static bool bindfs_init_failed = false;
/* PROTOTYPES */
-static int is_mirroring_enabled();
+static int is_mirroring_enabled(void);
/* Checks whether the uid is to be the mirrored owner of all files. */
static int is_mirrored_user(uid_t uid);
@@ -257,7 +257,7 @@ static size_t round_up_buffer_size_for_direct_io(size_t size);
#ifdef HAVE_FUSE_3
static void *bindfs_init(struct fuse_conn_info *conn, struct fuse_config *cfg);
#else
-static void *bindfs_init();
+static void *bindfs_init(void);
#endif
static void bindfs_destroy(void *private_data);
#ifdef HAVE_FUSE_3
@@ -345,14 +345,14 @@ static int process_option(void *data, const char *arg, int key,
struct fuse_args *outargs);
static int parse_mirrored_users(char* mirror);
static int parse_user_map(UserMap *map, UserMap *reverse_map, char *spec);
-static char *get_working_dir();
-static void maybe_stdout_stderr_to_file();
+static char *get_working_dir(void);
+static void maybe_stdout_stderr_to_file(void);
/* Sets up handling of SIGUSR1. */
-static void setup_signal_handling();
+static void setup_signal_handling(void);
static void signal_handler(int sig);
-static void atexit_func();
+static void atexit_func(void);
/*
Ignore some options (starting with -o)
@@ -364,7 +364,7 @@ are special ones interpreted by systemd in /etc/fstab
struct fuse_args filter_special_opts(struct fuse_args *args);
static bool keep_option(const char* opt);
-static int is_mirroring_enabled()
+static int is_mirroring_enabled(void)
{
return settings.num_mirrored_users + settings.num_mirrored_members > 0;
}
@@ -709,7 +709,7 @@ static size_t round_up_buffer_size_for_direct_io(size_t size)
#ifdef HAVE_FUSE_3
static void *bindfs_init(struct fuse_conn_info *conn, struct fuse_config *cfg)
#else
-static void *bindfs_init()
+static void *bindfs_init(void)
#endif
{
#ifdef HAVE_FUSE_3
@@ -2308,7 +2308,7 @@ fail:
return 0;
}
-static void maybe_stdout_stderr_to_file()
+static void maybe_stdout_stderr_to_file(void)
{
/* TODO: make this a command line option. */
#if 0
@@ -2331,7 +2331,7 @@ static void maybe_stdout_stderr_to_file()
#endif
}
-static char *get_working_dir()
+static char *get_working_dir(void)
{
size_t buf_size = 4096;
char* buf = malloc(buf_size);
@@ -2342,7 +2342,7 @@ static char *get_working_dir()
return buf;
}
-static void setup_signal_handling()
+static void setup_signal_handling(void)
{
struct sigaction sa;
sa.sa_handler = signal_handler;
@@ -2358,7 +2358,7 @@ static void signal_handler(int sig)
invalidate_user_cache();
}
-static void atexit_func()
+static void atexit_func(void)
{
free(settings.mntsrc);
free(settings.mntdest);
diff --git a/src/permchain.c b/src/permchain.c
index d101aa1..1e6fd98 100644
--- a/src/permchain.c
+++ b/src/permchain.c
@@ -40,7 +40,7 @@ struct permchain {
struct permchain *next;
};
-struct permchain *permchain_create()
+struct permchain *permchain_create(void)
{
struct permchain *pc = malloc(sizeof(struct permchain));
pc->mask = 0000;
diff --git a/src/permchain.h b/src/permchain.h
index 0f268f0..aad66f2 100644
--- a/src/permchain.h
+++ b/src/permchain.h
@@ -36,7 +36,7 @@
struct permchain;
-struct permchain *permchain_create();
+struct permchain *permchain_create(void);
/* Parses chmod arguments like 0777, a=rX, og-rwx etc.
Multiple rules may be given, separated with commas or colons.
diff --git a/src/rate_limiter.c b/src/rate_limiter.c
index 68763c7..fff8f21 100644
--- a/src/rate_limiter.c
+++ b/src/rate_limiter.c
@@ -28,7 +28,7 @@
const double rate_limiter_idle_credit = -0.2;
-double gettimeofday_clock()
+double gettimeofday_clock(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
@@ -50,7 +50,7 @@ static void sleep_seconds(double s)
nanosleep(&ts, NULL);
}
-void rate_limiter_init(RateLimiter *limiter, double rate, double (*clock)())
+void rate_limiter_init(RateLimiter *limiter, double rate, double (*clock)(void))
{
limiter->rate = rate;
limiter->clock = clock;
diff --git a/src/rate_limiter.h b/src/rate_limiter.h
index 95c0069..4a4ad85 100644
--- a/src/rate_limiter.h
+++ b/src/rate_limiter.h
@@ -30,16 +30,16 @@ extern const double rate_limiter_idle_credit;
typedef struct RateLimiter {
double rate; /* bytes / second */
- double (*clock)();
+ double (*clock)(void);
double last_modified;
double accumulated_sleep_time;
pthread_mutex_t mutex;
} RateLimiter;
-double gettimeofday_clock();
+double gettimeofday_clock(void);
/* 0 on success, error number on error. */
-void rate_limiter_init(RateLimiter* limiter, double rate, double (*clock)());
+void rate_limiter_init(RateLimiter* limiter, double rate, double (*clock)(void));
/* Blocks until the rate limiter clears `size` units. */
void rate_limiter_wait(RateLimiter* limiter, size_t size);
/* Updates the rate limiter like `rate_limiter_wait` but does not actually
diff --git a/src/userinfo.c b/src/userinfo.c
index a3ac91c..68291c1 100644
--- a/src/userinfo.c
+++ b/src/userinfo.c
@@ -52,13 +52,13 @@ static struct memory_block cache_memory_block = MEMORY_BLOCK_INITIALIZER;
static volatile int cache_rebuild_requested = 1;
-static void rebuild_cache();
+static void rebuild_cache(void);
static struct uid_cache_entry *uid_cache_lookup(uid_t key);
static struct gid_cache_entry *gid_cache_lookup(gid_t key);
-static int rebuild_uid_cache();
-static int rebuild_gid_cache();
-static void clear_uid_cache();
-static void clear_gid_cache();
+static int rebuild_uid_cache(void);
+static int rebuild_gid_cache(void);
+static void clear_uid_cache(void);
+static void clear_gid_cache(void);
static int uid_cache_name_sortcmp(const void *key, const void *entry);
static int uid_cache_name_searchcmp(const void *key, const void *entry);
static int uid_cache_uid_sortcmp(const void *key, const void *entry);
@@ -66,7 +66,7 @@ static int uid_cache_uid_searchcmp(const void *key, const void *entry);
static int gid_cache_gid_sortcmp(const void *key, const void *entry);
static int gid_cache_gid_searchcmp(const void *key, const void *entry);
-static void rebuild_cache()
+static void rebuild_cache(void)
{
free_memory_block(&cache_memory_block);
init_memory_block(&cache_memory_block, 1024);
@@ -98,7 +98,7 @@ static struct gid_cache_entry *gid_cache_lookup(gid_t key)
);
}
-static int rebuild_uid_cache()
+static int rebuild_uid_cache(void)
{
/* We're holding the lock, so we have mutual exclusion on getpwent and getgrent too. */
struct passwd *pw;
@@ -144,7 +144,7 @@ error:
return 0;
}
-static int rebuild_gid_cache()
+static int rebuild_gid_cache(void)
{
/* We're holding the lock, so we have mutual exclusion on getpwent and getgrent too. */
struct group *gr;
@@ -205,12 +205,12 @@ error:
return 0;
}
-static void clear_uid_cache()
+static void clear_uid_cache(void)
{
uid_cache_size = 0;
}
-static void clear_gid_cache()
+static void clear_gid_cache(void)
{
gid_cache_size = 0;
}
@@ -361,7 +361,7 @@ done:
return ret;
}
-void invalidate_user_cache()
+void invalidate_user_cache(void)
{
cache_rebuild_requested = 1;
}
diff --git a/src/userinfo.h b/src/userinfo.h
index 4c0ca55..6886284 100644
--- a/src/userinfo.h
+++ b/src/userinfo.h
@@ -35,6 +35,6 @@ int user_uid(const char *username, uid_t *ret);
int group_gid(const char *groupname, gid_t *ret);
int user_belongs_to_group(uid_t uid, gid_t gid);
-void invalidate_user_cache(); /* safe to call from signal handler */
+void invalidate_user_cache(void); /* safe to call from signal handler */
#endif
diff --git a/src/usermap.c b/src/usermap.c
index eb7b61c..456bc74 100644
--- a/src/usermap.c
+++ b/src/usermap.c
@@ -14,7 +14,7 @@ struct UserMap {
int group_size;
};
-UserMap *usermap_create()
+UserMap *usermap_create(void)
{
UserMap* map = (UserMap*)malloc(sizeof(UserMap));
map->user_from = NULL;
diff --git a/src/usermap.h b/src/usermap.h
index 9c1387e..db2a9c3 100644
--- a/src/usermap.h
+++ b/src/usermap.h
@@ -37,7 +37,7 @@ typedef enum UsermapStatus {
usermap_status_duplicate_key = 1
} UsermapStatus;
-UserMap *usermap_create();
+UserMap *usermap_create(void);
void usermap_destroy(UserMap *map);
UsermapStatus usermap_add_uid(UserMap *map, uid_t from, uid_t to);