summaryrefslogtreecommitdiff
path: root/source3/torture/torture.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2019-03-26 09:48:16 +0100
committerJeremy Allison <jra@samba.org>2019-03-27 12:31:37 +0000
commit3e1d8ab1255f1797a1803494b6333dc7990e0795 (patch)
tree068805c74fb947f5a8958e428543ff523c554d12 /source3/torture/torture.c
parent3478e9d124f95344d67f1794e92658fa253b48fd (diff)
downloadsamba-3e1d8ab1255f1797a1803494b6333dc7990e0795.tar.gz
libsmb: Change cli_posix_readlink to return talloc'ed target
This is a deviation from the Posix readlink function that from my point of view makes this function easier to use. In Posix, probably the assumption is that readlink is cheap, so someone under memory constraints could just start with a small buffer and incrementally increase the buffer size. For us, it's a network round-trip, and we have the luxury of [mt]alloc, which the syscall kernel interface does not have. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Mar 27 12:31:37 UTC 2019 on sn-devel-144
Diffstat (limited to 'source3/torture/torture.c')
-rw-r--r--source3/torture/torture.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index c7b3bf28041..219ac4a370c 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -6228,7 +6228,7 @@ static bool run_simple_posix_open_test(int dummy)
const char *sname = "posix:symlink";
const char *dname = "posix:dir";
char buf[10];
- char namebuf[11];
+ char *target = NULL;
uint16_t fnum1 = (uint16_t)-1;
SMB_STRUCT_STAT sbuf;
bool correct = false;
@@ -6515,15 +6515,15 @@ static bool run_simple_posix_open_test(int dummy)
}
}
- status = cli_posix_readlink(cli1, sname, namebuf, sizeof(namebuf));
+ status = cli_posix_readlink(cli1, sname, talloc_tos(), &target);
if (!NT_STATUS_IS_OK(status)) {
printf("POSIX readlink on %s failed (%s)\n", sname, nt_errstr(status));
goto out;
}
- if (strcmp(namebuf, fname) != 0) {
+ if (strcmp(target, fname) != 0) {
printf("POSIX readlink on %s failed to match name %s (read %s)\n",
- sname, fname, namebuf);
+ sname, fname, target);
goto out;
}