freebsd-src icon indicating copy to clipboard operation
freebsd-src copied to clipboard

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

Open rilysh opened this issue 1 year ago • 1 comments

  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.
  2. 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.
  3. Indent the error message a bit in chdir().

rilysh avatar Jan 18 '24 08:01 rilysh

looks like the style checker is just erroring out

either way, you can squash those two commits

igalic avatar Feb 03 '24 22:02 igalic

landed.

bsdimp avatar Apr 23 '24 22:04 bsdimp

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.

bsdimp avatar Apr 24 '24 03:04 bsdimp