diff options
-rw-r--r-- | usr.sbin/bsdinstall/distextract/distextract.c | 9 | ||||
-rw-r--r-- | usr.sbin/bsdinstall/distfetch/distfetch.c | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/usr.sbin/bsdinstall/distextract/distextract.c b/usr.sbin/bsdinstall/distextract/distextract.c index a76ebfe..0afe761 100644 --- a/usr.sbin/bsdinstall/distextract/distextract.c +++ b/usr.sbin/bsdinstall/distextract/distextract.c @@ -38,9 +38,16 @@ static int extract_files(int nfiles, const char **files); int main(void) { - char *diststring = strdup(getenv("DISTRIBUTIONS")); + char *diststring; const char **dists; int i, retval, ndists = 0; + + if (getenv("DISTRIBUTIONS") == NULL) { + fprintf(stderr, "DISTRIBUTIONS variable is not set\n"); + return (1); + } + + diststring = strdup(getenv("DISTRIBUTIONS")); for (i = 0; diststring[i] != 0; i++) if (isspace(diststring[i]) && !isspace(diststring[i+1])) ndists++; diff --git a/usr.sbin/bsdinstall/distfetch/distfetch.c b/usr.sbin/bsdinstall/distfetch/distfetch.c index bb72417..ae5766c 100644 --- a/usr.sbin/bsdinstall/distfetch/distfetch.c +++ b/usr.sbin/bsdinstall/distfetch/distfetch.c @@ -37,9 +37,16 @@ static int fetch_files(int nfiles, char **urls); int main(void) { - char *diststring = strdup(getenv("DISTRIBUTIONS")); + char *diststring; char **urls; int i, nfetched, ndists = 0; + + if (getenv("DISTRIBUTIONS") == NULL) { + fprintf(stderr, "DISTRIBUTIONS variable is not set\n"); + return (1); + } + + diststring = strdup(getenv("DISTRIBUTIONS")); for (i = 0; diststring[i] != 0; i++) if (isspace(diststring[i]) && !isspace(diststring[i+1])) ndists++; |