mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
libsmb: Simplify callers of SMBC_dlist_contains()
This function already does the NULL check on the file pointer Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
20b99b03a0
commit
4734b64e3f
@ -1041,7 +1041,7 @@ SMBC_closedir_ctx(SMBCCTX *context,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!dir || !SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
errno = EBADF;
|
||||
TALLOC_FREE(frame);
|
||||
return -1;
|
||||
@ -1154,7 +1154,7 @@ SMBC_readdir_ctx(SMBCCTX *context,
|
||||
|
||||
}
|
||||
|
||||
if (!dir || !SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
|
||||
errno = EBADF;
|
||||
DEBUG(0, ("Invalid dir in SMBC_readdir_ctx()\n"));
|
||||
@ -1233,7 +1233,7 @@ SMBC_readdirplus_ctx(SMBCCTX *context,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (dir == NULL || !SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
DBG_ERR("Invalid dir in SMBC_readdirplus_ctx()\n");
|
||||
TALLOC_FREE(frame);
|
||||
errno = EBADF;
|
||||
@ -1312,7 +1312,7 @@ const struct libsmb_file_info *SMBC_readdirplus2_ctx(SMBCCTX *context,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (dir == NULL || !SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
DBG_ERR("Invalid dir in SMBC_readdirplus2_ctx()\n");
|
||||
TALLOC_FREE(frame);
|
||||
errno = EBADF;
|
||||
@ -1417,7 +1417,7 @@ SMBC_getdents_ctx(SMBCCTX *context,
|
||||
|
||||
}
|
||||
|
||||
if (!dir || !SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
|
||||
errno = EBADF;
|
||||
TALLOC_FREE(frame);
|
||||
@ -1784,7 +1784,7 @@ SMBC_telldir_ctx(SMBCCTX *context,
|
||||
|
||||
}
|
||||
|
||||
if (!dir || !SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
|
||||
errno = EBADF;
|
||||
TALLOC_FREE(frame);
|
||||
@ -2628,8 +2628,7 @@ SMBC_notify_ctx(SMBCCTX *context, SMBCFILE *dir, smbc_bool recursive,
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
if ((dir == NULL) ||
|
||||
!SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, dir)) {
|
||||
TALLOC_FREE(frame);
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
|
@ -258,7 +258,7 @@ SMBC_read_ctx(SMBCCTX *context,
|
||||
|
||||
DEBUG(4, ("smbc_read(%p, %d)\n", file, (int)count));
|
||||
|
||||
if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, file)) {
|
||||
errno = EBADF;
|
||||
TALLOC_FREE(frame);
|
||||
return -1;
|
||||
@ -308,17 +308,13 @@ SMBC_splice_ctx(SMBCCTX *context,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!srcfile ||
|
||||
!SMBC_dlist_contains(context->internal->files, srcfile))
|
||||
{
|
||||
if (!SMBC_dlist_contains(context->internal->files, srcfile)) {
|
||||
errno = EBADF;
|
||||
TALLOC_FREE(frame);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!dstfile ||
|
||||
!SMBC_dlist_contains(context->internal->files, dstfile))
|
||||
{
|
||||
if (!SMBC_dlist_contains(context->internal->files, dstfile)) {
|
||||
errno = EBADF;
|
||||
TALLOC_FREE(frame);
|
||||
return -1;
|
||||
@ -363,7 +359,7 @@ SMBC_write_ctx(SMBCCTX *context,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, file)) {
|
||||
errno = EBADF;
|
||||
TALLOC_FREE(frame);
|
||||
return -1;
|
||||
@ -409,7 +405,7 @@ SMBC_close_ctx(SMBCCTX *context,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, file)) {
|
||||
errno = EBADF;
|
||||
TALLOC_FREE(frame);
|
||||
return -1;
|
||||
@ -681,7 +677,7 @@ SMBC_lseek_ctx(SMBCCTX *context,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, file)) {
|
||||
errno = EBADF;
|
||||
TALLOC_FREE(frame);
|
||||
return -1;
|
||||
@ -744,7 +740,7 @@ SMBC_ftruncate_ctx(SMBCCTX *context,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, file)) {
|
||||
errno = EBADF;
|
||||
TALLOC_FREE(frame);
|
||||
return -1;
|
||||
|
@ -251,7 +251,7 @@ SMBC_fstat_ctx(SMBCCTX *context,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
|
||||
if (!SMBC_dlist_contains(context->internal->files, file)) {
|
||||
errno = EBADF;
|
||||
TALLOC_FREE(frame);
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user