/**
* create new fsp to be used for file_new or a durable handle reconnect
*/
-NTSTATUS fsp_new(struct connection_struct *conn, TALLOC_CTX *mem_ctx,
- files_struct **result)
+struct files_struct *fsp_new(TALLOC_CTX *mem_ctx,
+ struct connection_struct *conn)
{
- NTSTATUS status = NT_STATUS_NO_MEMORY;
files_struct *fsp = NULL;
struct smbd_server_connection *sconn = conn->sconn;
DBG_INFO("allocated files structure (%u used)\n",
(unsigned int)sconn->num_files);
- *result = fsp;
- return NT_STATUS_OK;
+ return fsp;
fail:
if (fsp != NULL) {
}
TALLOC_FREE(fsp);
- return status;
+ return NULL;
}
void fsp_set_gen_id(files_struct *fsp)
files_struct *fsp;
NTSTATUS status;
- status = fsp_new(conn, conn, &fsp);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ fsp = fsp_new(conn, conn);
+ if (fsp == NULL) {
+ return NT_STATUS_NO_MEMORY;
}
GetTimeOfDay(&fsp->open_time);
SMB_ASSERT(smb_fname->fsp == NULL);
- status = fsp_new(conn, conn, &fsp);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ fsp = fsp_new(conn, conn);
+ if (fsp == NULL) {
+ return NT_STATUS_NO_MEMORY;
}
GetTimeOfDay(&fsp->open_time);
int fd;
bool ok;
- status = fsp_new(conn, conn, &fsp);
- if (!NT_STATUS_IS_OK(status)) {
- goto fail;
+ fsp = fsp_new(conn, conn);
+ if (fsp == NULL) {
+ return NT_STATUS_NO_MEMORY;
}
GetTimeOfDay(&fsp->open_time);
ZERO_STRUCT(conn->sconn->fsp_fi_cache);
return NT_STATUS_NO_MEMORY;
}
- status = fsp_new(conn, conn, &fsp);
- if (!NT_STATUS_IS_OK(status)) {
- goto fail;
+ fsp = fsp_new(conn, conn);
+ if (fsp == NULL) {
+ goto nomem;
}
GetTimeOfDay(&fsp->open_time);
DBG_DEBUG("path_in=%s\n", path_in);
- status = fsp_new(conn, conn, &fsp);
- if (!NT_STATUS_IS_OK(status)) {
- DBG_DEBUG("fsp_new() failed: %s\n", nt_errstr(status));
- goto fail;
+ fsp = fsp_new(conn, conn);
+ if (fsp == NULL) {
+ DBG_DEBUG("fsp_new() failed\n");
+ goto nomem;
}
GetTimeOfDay(&fsp->open_time);
dirfsp = fsp;
if (tmp == in_dirfsp) {
- status = fsp_new(conn, conn, &fsp);
- if (!NT_STATUS_IS_OK(status)) {
- DBG_DEBUG("fsp_new() failed: %s\n",
- nt_errstr(status));
- goto fail;
+ fsp = fsp_new(conn, conn);
+ if (fsp == NULL) {
+ DBG_DEBUG("fsp_new() failed\n");
+ goto nomem;
}
fsp->fsp_name = &full_fname;
} else {
return NT_STATUS_NETWORK_OPEN_RESTRICTION;
}
- status = fsp_new(conn, conn, &fsp);
- if (!NT_STATUS_IS_OK(status)) {
- DBG_DEBUG("fsp_new() failed: %s\n", nt_errstr(status));
- return status;
+ fsp = fsp_new(conn, conn);
+ if (fsp == NULL) {
+ DBG_DEBUG("fsp_new() failed\n");
+ return NT_STATUS_NO_MEMORY;
}
GetTimeOfDay(&fsp->open_time);
return NT_STATUS_NO_MEMORY;
}
- status = fsp_new(conn, conn, &fsp);
- if (!NT_STATUS_IS_OK(status)) {
- DBG_DEBUG("fsp_new() failed: %s\n", nt_errstr(status));
- return status;
+ fsp = fsp_new(conn, conn);
+ if (fsp == NULL) {
+ DBG_DEBUG("fsp_new() failed\n");
+ return NT_STATUS_NO_MEMORY;
}
GetTimeOfDay(&fsp->open_time);