r14803: copy with the root directory, which has /. on the end of the path
authorAndrew Tridgell <tridge@samba.org>
Thu, 30 Mar 2006 05:45:43 +0000 (05:45 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:59:21 +0000 (13:59 -0500)
(This used to be commit 16742cd28621d205f21c855e5635be1dfc3f2b69)

source4/ntvfs/common/notify.c

index b71c2906ae16aef8cdfe4b64ab02d31aa70271c4..52abc08d740d06556cdd6ba6882e8bbc391c87f0 100644 (file)
@@ -227,6 +227,8 @@ NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e,
 {
        NTSTATUS status;
        struct notify_list *listel;
+       char *path = NULL;
+       size_t len;
 
        status = notify_load(notify);
        NT_STATUS_NOT_OK_RETURN(status);
@@ -239,14 +241,29 @@ NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e,
                return NT_STATUS_NO_MEMORY;
        }
 
+       /* cope with /. on the end of the path */
+       len = strlen(e->path);
+       if (len > 1 && e->path[len-1] == '.' && e->path[len-2] == '/') {
+               path = talloc_strndup(notify, e->path, len-2);
+       }
+
        notify->array->entries[notify->array->num_entries] = *e;
        notify->array->entries[notify->array->num_entries].private = private;
        notify->array->entries[notify->array->num_entries].server = notify->server;
+
+       if (path) {
+               notify->array->entries[notify->array->num_entries].path = path;
+       }
+
        notify->array->num_entries++;
 
        status = notify_save(notify);
        NT_STATUS_NOT_OK_RETURN(status);
 
+       if (path) {
+               talloc_free(path);
+       }
+
        listel = talloc(notify, struct notify_list);
        NT_STATUS_HAVE_NO_MEMORY(listel);