HomeFreeBSD

bsdinstall/distfetch.c: check environment variables before downloading and…

Description

bsdinstall/distfetch.c: check environment variables before downloading and handle memory allocation errors

  1. Currently, distfetch checks environment variables existence

when it will use them or in a case (in chdir()) it doesn't check
at all. As they are necessary to set before doing anything with
it, check them, if they set or not, before proceeding any further.
This also avoids extra cleaning when that environment variable
isn't set.

  1. Handle memory allocation error in malloc(PATH_MAX) and replace

(sizeof const char *) with (sizeof char *). Both are similar and
const doesn't have a size.

  1. Indent the error message a bit in chdir().

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1071

Details

Provenance
rilysh <nightquick@proton.me>Authored on Apr 23 2024, 10:40 PM
impCommitted on Apr 23 2024, 10:42 PM
Parents
rG0d4ad64077bc: zfs: merge openzfs/zfs@1f940de07
Branches
Unknown
Tags
Unknown
Reverted By
rG560931508c7d: Revert "bsdinstall/distfetch.c: check environment variables before downloading…