mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
vfs: Simplify stream_dir()
We know in advance how large "id_hex" is. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
fca8887900
commit
0dfaa08ce3
@ -158,10 +158,10 @@ static char *stream_dir(vfs_handle_struct *handle,
|
||||
SMB_STRUCT_STAT base_sbuf_tmp;
|
||||
char *tmp = NULL;
|
||||
uint8_t first, second;
|
||||
char *id_hex;
|
||||
struct file_id id;
|
||||
uint8_t id_buf[16];
|
||||
bool check_valid;
|
||||
char id_hex[sizeof(id_buf) * 2 + 1];
|
||||
char *rootdir = NULL;
|
||||
struct smb_filename *rootdir_fname = NULL;
|
||||
struct smb_filename *tmp_fname = NULL;
|
||||
@ -223,18 +223,11 @@ static char *stream_dir(vfs_handle_struct *handle,
|
||||
first = hash & 0xff;
|
||||
second = (hash >> 8) & 0xff;
|
||||
|
||||
id_hex = hex_encode_talloc(talloc_tos(), id_buf, sizeof(id_buf));
|
||||
|
||||
if (id_hex == NULL) {
|
||||
errno = ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
hex_encode_buf(id_hex, id_buf, sizeof(id_buf));
|
||||
|
||||
result = talloc_asprintf(talloc_tos(), "%s/%2.2X/%2.2X/%s", rootdir,
|
||||
first, second, id_hex);
|
||||
|
||||
TALLOC_FREE(id_hex);
|
||||
|
||||
if (result == NULL) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user