smbd: Make add_share_mode return bool
authorVolker Lendecke <vl@samba.org>
Sat, 14 Sep 2013 11:48:03 +0000 (13:48 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 8 Oct 2013 21:42:17 +0000 (14:42 -0700)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/locking.c

index d701964229d00f6c990d65e2ea23a00e87bb7a14..f584e0cf6526465d30da4c1e94a9a982230a4efa 100644 (file)
@@ -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,