diff options
author | Volker Lendecke <vl@samba.org> | 2019-03-26 09:48:16 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-03-27 12:31:37 +0000 |
commit | 3e1d8ab1255f1797a1803494b6333dc7990e0795 (patch) | |
tree | 068805c74fb947f5a8958e428543ff523c554d12 /source3/client | |
parent | 3478e9d124f95344d67f1794e92658fa253b48fd (diff) | |
download | samba-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/client')
-rw-r--r-- | source3/client/client.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index 366368630cb..a69ab5daa76 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -3487,7 +3487,7 @@ static int cmd_readlink(void) char *name= NULL; char *buf = NULL; char *targetname = NULL; - char linkname[PATH_MAX+1]; + char *linkname = NULL; struct cli_state *targetcli; NTSTATUS status; @@ -3519,7 +3519,7 @@ static int cmd_readlink(void) return 1; } - status = cli_posix_readlink(targetcli, name, linkname, PATH_MAX+1); + status = cli_posix_readlink(targetcli, name, talloc_tos(), &linkname); if (!NT_STATUS_IS_OK(status)) { d_printf("%s readlink on file %s\n", nt_errstr(status), name); @@ -3528,6 +3528,8 @@ static int cmd_readlink(void) d_printf("%s -> %s\n", name, linkname); + TALLOC_FREE(linkname); + return 0; } |