From ad2ba58f53a7fb6b87511288cb450f1327f1ccbf Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 14 Sep 2013 13:48:03 +0200 Subject: [PATCH] smbd: Make add_share_mode return bool Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/locking/locking.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/source3/locking/locking.c b/source3/locking/locking.c index d701964229..f584e0cf65 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -717,12 +717,21 @@ static void fill_share_mode_entry(struct share_mode_entry *e, e->name_hash = fsp->name_hash; } -static void add_share_mode_entry(struct share_mode_data *d, +static bool add_share_mode_entry(struct share_mode_data *d, const struct share_mode_entry *entry) { - ADD_TO_ARRAY(d, struct share_mode_entry, *entry, - &d->share_modes, &d->num_share_modes); - d->modified = True; + struct share_mode_entry *tmp; + + tmp = talloc_realloc(d, d->share_modes, struct share_mode_entry, + d->num_share_modes+1); + if (tmp == NULL) { + return false; + } + d->share_modes = tmp; + d->share_modes[d->num_share_modes] = *entry; + d->num_share_modes += 1; + d->modified = true; + return true; } void set_share_mode(struct share_mode_lock *lck, files_struct *fsp, -- 2.34.1