uint64_t fnum = fsp->fnum;
if (fsp->notify) {
- struct notify_context *notify_ctx =
- fsp->conn->sconn->notify_ctx;
- notify_remove(notify_ctx, fsp);
+ size_t len = fsp_fullbasepath(fsp, NULL, 0);
+ char fullpath[len+1];
+
+ fsp_fullbasepath(fsp, fullpath, sizeof(fullpath));
+
+ /*
+ * Avoid /. at the end of the path name. notify can't
+ * deal with it.
+ */
+ if (len > 1 && fullpath[len-1] == '.' &&
+ fullpath[len-2] == '/') {
+ fullpath[len-2] = '\0';
+ }
+
+ notify_remove(fsp->conn->sconn->notify_ctx, fsp, fullpath);
TALLOC_FREE(fsp->notify);
}
return NT_STATUS_OK;
}
-NTSTATUS notify_remove(struct notify_context *ctx, void *private_data)
+NTSTATUS notify_remove(struct notify_context *ctx, void *private_data,
+ char *path)
{
struct notify_list *listel;
struct notify_rec_change_msg msg = {};
iov[0].iov_base = &msg;
iov[0].iov_len = offsetof(struct notify_rec_change_msg, path);
- iov[1].iov_base = discard_const_p(char, listel->path);
- iov[1].iov_len = strlen(listel->path)+1;
+ iov[1].iov_base = path;
+ iov[1].iov_len = strlen(path)+1;
status = messaging_send_iov(
ctx->msg_ctx, ctx->notifyd, MSG_SMB_NOTIFY_REC_CHANGE,
void (*callback)(void *, struct timespec,
const struct notify_event *),
void *private_data);
-NTSTATUS notify_remove(struct notify_context *notify, void *private_data);
+NTSTATUS notify_remove(struct notify_context *ctx, void *private_data,
+ char *path);
void notify_trigger(struct notify_context *notify,
uint32_t action, uint32_t filter,
const char *dir, const char *path);