}
notify->db_onelevel = db_open(notify, lock_path("notify_onelevel.tdb"),
- 0, TDB_SEQNUM|TDB_CLEAR_IF_FIRST,
+ 0, TDB_CLEAR_IF_FIRST,
O_RDWR|O_CREAT, 0644);
if (notify->db_onelevel == NULL) {
talloc_free(notify);
/*
compare notify entries for sorting
*/
-static int notify_compare(const void *p1, const void *p2)
+static int notify_compare(const struct notify_entry *e1, const struct notify_entry *e2)
{
- const struct notify_entry *e1 = (const struct notify_entry *)p1;
- const struct notify_entry *e2 = (const struct notify_entry *)p2;
return strcmp(e1->path, e2->path);
}
d->max_mask |= e->filter;
d->max_mask_subdir |= e->subdir_filter;
- if (d->num_entries > 1) {
- qsort(d->entries, d->num_entries, sizeof(d->entries[0]), notify_compare);
- }
+ TYPESAFE_QSORT(d->entries, d->num_entries, notify_compare);
/* recalculate the maximum masks */
d->max_mask = 0;
NTSTATUS status;
int i;
+ if (notify == NULL) {
+ return NT_STATUS_NOT_IMPLEMENTED;
+ }
+
array = talloc_zero(talloc_tos(), struct notify_entry_array);
if (array == NULL) {
return NT_STATUS_NO_MEMORY;
}
rec = notify->db_onelevel->fetch_locked(
- notify->db_onelevel, talloc_tos(),
+ notify->db_onelevel, array,
make_tdb_data((uint8_t *)fid, sizeof(*fid)));
if (rec == NULL) {
DEBUG(10, ("notify_remove_onelevel: fetch_locked for %s failed"
bool have_dead_entries = false;
int i;
+ if (notify == NULL) {
+ return;
+ }
+
array = talloc_zero(talloc_tos(), struct notify_entry_array);
if (array == NULL) {
return;