mirror of
https://git.sr.ht/~nabijaczleweli/tzpfms
synced 2025-06-04 22:23:02 +03:00
reallocarray when reallocarraying
This commit is contained in:
parent
52a4871ce0
commit
a77e6c1d80
@ -129,10 +129,9 @@ int main(int argc, char ** argv) {
|
|||||||
TRY_MAIN(lookup_userprop(dataset, PROPNAME_BACKEND, backend));
|
TRY_MAIN(lookup_userprop(dataset, PROPNAME_BACKEND, backend));
|
||||||
TRY_MAIN(lookup_userprop(dataset, PROPNAME_KEY, handle));
|
TRY_MAIN(lookup_userprop(dataset, PROPNAME_KEY, handle));
|
||||||
|
|
||||||
++lines_len;
|
lines = TRY_PTR("allocate line buffer", reinterpret_cast<output_line *>(reallocarray(lines, ++lines_len, sizeof(output_line))));
|
||||||
lines = TRY_PTR("allocate line buffer", reinterpret_cast<output_line *>(realloc(lines, sizeof(output_line) * lines_len)));
|
|
||||||
|
|
||||||
auto & cur_line = lines[lines_len - 1];
|
auto & cur_line = lines[lines_len - 1];
|
||||||
|
|
||||||
strncpy(cur_line.name, zfs_get_name(dataset), ZFS_MAX_DATASET_NAME_LEN);
|
strncpy(cur_line.name, zfs_get_name(dataset), ZFS_MAX_DATASET_NAME_LEN);
|
||||||
strncpy(cur_line.backend, (backend && strlen(backend) <= TZPFMS_BACKEND_MAX_LEN) ? backend : "\0", TZPFMS_BACKEND_MAX_LEN);
|
strncpy(cur_line.backend, (backend && strlen(backend) <= TZPFMS_BACKEND_MAX_LEN) ? backend : "\0", TZPFMS_BACKEND_MAX_LEN);
|
||||||
// Tristate available/unavailable/none, but it's gonna be either available or unavailable on envryption roots, so
|
// Tristate available/unavailable/none, but it's gonna be either available or unavailable on envryption roots, so
|
||||||
|
Loading…
x
Reference in New Issue
Block a user