freebsd-src
freebsd-src copied to clipboard
bsdinstall/distfetch.c: check environment variables before downloading and handle memory allocation errors
- 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.
- 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.
- Indent the error message a bit in chdir().
looks like the style checker is just erroring out
either way, you can squash those two commits
landed.
I backed this out after pushing. I'd somehow gotten the impression that @jrtc27 's objections had been addressed, but I was mistaken. Also looking at it critically, it fails our newer guidance on relevance and fixing a known problem, so I'll leave it closed.