From d660273869a8fb4c566312582bd3f6b87f5ea23a Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Thu, 22 Feb 2018 15:52:46 +0100 Subject: [PATCH] vfs_fruit: use off_t, not size_t for TM size calculations size_t is only a 32-bit integer on 32-bit platforms. We must use off_t for file sizes. https://bugzilla.samba.org/show_bug.cgi?id=13296 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison (cherry picked from commit f9e2cb1369fa9636ff613a4e9c7387151409eafc) --- source3/modules/vfs_fruit.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 40ee2553a12..ec76f718c37 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -141,7 +141,7 @@ struct fruit_config_data { bool aapl_zero_file_id; const char *model; bool time_machine; - size_t time_machine_max_size; + off_t time_machine_max_size; /* * Additional options, all enabled by default, @@ -1989,8 +1989,7 @@ static int init_fruit_config(vfs_handle_struct *handle) SNUM(handle->conn), FRUIT_PARAM_TYPE_NAME, "time machine max size", NULL); if (tm_size_str != NULL) { - config->time_machine_max_size = - (size_t)conv_str_size(tm_size_str); + config->time_machine_max_size = conv_str_size(tm_size_str); } SMB_VFS_HANDLE_SET_DATA(handle, config, @@ -6321,7 +6320,7 @@ static bool fruit_get_bandsize(vfs_handle_struct *handle, } struct fruit_disk_free_state { - size_t total_size; + off_t total_size; }; static bool fruit_get_num_bands(vfs_handle_struct *handle, @@ -6394,7 +6393,7 @@ static bool fruit_tmsize_do_dirent(vfs_handle_struct *handle, size_t sparsebundle_strlen = strlen("sparsebundle"); size_t bandsize = 0; size_t nbands; - double tm_size; + off_t tm_size; p = strstr(e->d_name, "sparsebundle"); if (p == NULL) { @@ -6444,8 +6443,8 @@ static bool fruit_tmsize_do_dirent(vfs_handle_struct *handle, state->total_size += tm_size; - DBG_DEBUG("[%s] tm_size [%.0f] total_size [%zu]\n", - e->d_name, tm_size, state->total_size); + DBG_DEBUG("[%s] tm_size [%jd] total_size [%jd]\n", + e->d_name, (intmax_t)tm_size, (intmax_t)state->total_size); return true; } -- 2.13.6