diff options
author | Javier <dev.git@javispedro.com> | 2017-04-18 00:32:55 +0200 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2017-04-18 00:32:55 +0200 |
commit | 49be4df82c4c70354b116b7d651d6eb12db1e289 (patch) | |
tree | 75a97b9b6a3ec192b04b5e4a0290ef8c1a31cb5c /src | |
parent | f9fced6a3372c133a54c6b7db084bc1fa1eebc97 (diff) | |
download | volumefs-49be4df82c4c70354b116b7d651d6eb12db1e289.tar.gz volumefs-49be4df82c4c70354b116b7d651d6eb12db1e289.zip |
fix plenty of undefined behavior
Diffstat (limited to 'src')
-rw-r--r-- | src/usersfs.c | 5 | ||||
-rw-r--r-- | src/volumesfs.c | 9 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/usersfs.c b/src/usersfs.c index 834779d..bb76ed1 100644 --- a/src/usersfs.c +++ b/src/usersfs.c @@ -41,13 +41,14 @@ static int usersfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, struct passwd *pwent; setpwent(); - while (pwent = getpwent()) { + while ((pwent = getpwent())) { if ((pwent->pw_uid == 0 || pwent->pw_uid >= 1000) && pwent->pw_name && pwent->pw_dir) { filler(buf, pwent->pw_name, NULL, 0); } } setpwent(); + return 0; } static int usersfs_readlink(const char *path, char *buf, size_t size) @@ -67,7 +68,7 @@ static int usersfs_readlink(const char *path, char *buf, size_t size) static struct fuse_operations usersfs_oper = { .getattr = usersfs_getattr, - .readdir = usersfs_readdir, + .readdir = usersfs_readdir, .readlink = usersfs_readlink }; diff --git a/src/volumesfs.c b/src/volumesfs.c index 4226b94..acf991b 100644 --- a/src/volumesfs.c +++ b/src/volumesfs.c @@ -70,6 +70,8 @@ static gpointer sub_thread_main(gpointer user_data) udisks_changed(client, NULL); g_main_loop_run(main_loop); + + return NULL; } static void * volumesfs_init(struct fuse_conn_info *conn) @@ -79,6 +81,8 @@ static void * volumesfs_init(struct fuse_conn_info *conn) mounts = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); sub_thread = g_thread_new("volumesfs-sub-thread", sub_thread_main, NULL); + + return NULL; } static void volumesfs_destroy(void *user_data) @@ -126,7 +130,6 @@ static int volumesfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler filler(buf, ".", NULL, 0); filler(buf, "..", NULL, 0); - GHashTableIter iter; gchar *name; g_hash_table_iter_init(&iter, mounts); @@ -135,6 +138,8 @@ static int volumesfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler } G_UNLOCK(mounts); + + return 0; } static int volumesfs_readlink(const char *path, char *buf, size_t size) @@ -159,7 +164,7 @@ static struct fuse_operations volumesfs_oper = { .init = volumesfs_init, .destroy = volumesfs_destroy, .getattr = volumesfs_getattr, - .readdir = volumesfs_readdir, + .readdir = volumesfs_readdir, .readlink = volumesfs_readlink }; |