diff options
author | Volker Lendecke <vl@samba.org> | 2016-06-13 16:22:31 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-07-20 05:21:06 +0200 |
commit | ed26f4b22ab33f7124a4393ee2f7cdb993b5adec (patch) | |
tree | 364439d30027ad64380e4ceaaf9ba8f4ecc9596f /source3 | |
parent | ea47abcf3c9e750fa6315ec1de0c18f9fb4faaeb (diff) | |
download | samba-ed26f4b22ab33f7124a4393ee2f7cdb993b5adec.tar.gz |
smbd: Avoid a talloc_asprintf
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/notify.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index d7382db6938..2f07192a92e 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -251,8 +251,8 @@ static void notify_callback(void *private_data, struct timespec when, NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter, bool recursive) { - char *fullpath; - size_t len; + size_t len = fsp_fullbasepath(fsp, NULL, 0); + char fullpath[len+1]; uint32_t subdir_filter; NTSTATUS status = NT_STATUS_NOT_IMPLEMENTED; @@ -267,20 +267,11 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter, return NT_STATUS_NO_MEMORY; } - /* Do notify operations on the base_name. */ - fullpath = talloc_asprintf( - talloc_tos(), "%s/%s", fsp->conn->connectpath, - fsp->fsp_name->base_name); - if (fullpath == NULL) { - DEBUG(0, ("talloc_asprintf failed\n")); - TALLOC_FREE(fsp->notify); - return NT_STATUS_NO_MEMORY; - } + fsp_fullbasepath(fsp, fullpath, sizeof(fullpath)); /* * Avoid /. at the end of the path name. notify can't deal with it. */ - len = strlen(fullpath); if (len > 1 && fullpath[len-1] == '.' && fullpath[len-2] == '/') { fullpath[len-2] = '\0'; } @@ -292,7 +283,7 @@ NTSTATUS change_notify_create(struct files_struct *fsp, uint32_t filter, fullpath, filter, subdir_filter, notify_callback, fsp); } - TALLOC_FREE(fullpath); + return status; } |