summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2020-02-21 22:35:44 +0100
committerAndreas Schneider <asn@cryptomilk.org>2020-05-25 08:13:27 +0000
commit4734b64e3f9797894b7e8a2ce8119a099166a72c (patch)
tree4ae841a46e5b33bdbc67e2eb3a0bb55d81ef03f0
parent20b99b03a0795b920ac2be9d7e51bc6819f3d24f (diff)
downloadsamba-4734b64e3f9797894b7e8a2ce8119a099166a72c.tar.gz
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>
-rw-r--r--source3/libsmb/libsmb_dir.c15
-rw-r--r--source3/libsmb/libsmb_file.c18
-rw-r--r--source3/libsmb/libsmb_stat.c2
3 files changed, 15 insertions, 20 deletions
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index 2aa78b6b6cd..3ebdb76e203 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -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;
diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c
index e4baa3b6adc..8e2632ef1ce 100644
--- a/source3/libsmb/libsmb_file.c
+++ b/source3/libsmb/libsmb_file.c
@@ -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;
diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c
index 2372ec7454a..2b80415f002 100644
--- a/source3/libsmb/libsmb_stat.c
+++ b/source3/libsmb/libsmb_stat.c
@@ -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;