summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdinstall/distfetch
diff options
context:
space:
mode:
authordteske <dteske@FreeBSD.org>2014-10-01 18:59:57 +0000
committerdteske <dteske@FreeBSD.org>2014-10-01 18:59:57 +0000
commitb1da57a21d9f5aa8e6e10c809e10aa0060f3fad5 (patch)
tree0d8d68c631a34c26481b359fa7a07c203b5c48b2 /usr.sbin/bsdinstall/distfetch
parent77fb3d6bbe22a497bc8259c30ad2b2c45c3fa985 (diff)
downloadFreeBSD-src-b1da57a21d9f5aa8e6e10c809e10aa0060f3fad5.zip
FreeBSD-src-b1da57a21d9f5aa8e6e10c809e10aa0060f3fad5.tar.gz
Optimize program flow for execution speed. Also fix some more style(9) nits
while here: + Fix an issue when extracting small archives where dialog_mixedgauge was not rendering; leaving the user wondering if anything happened. + Add #ifdef's to assuage compilation against older libarchive NB: Minimize diff between branches; make merging easier. + Add missing calls to end_dialog(3) + Change string processing from strtok(3) to strcspn(3) (O(1) optimization) + Use EXIT_SUCCESS and EXIT_FAILURE instead of 0/1 + Optimize getenv(3) use, using stored results instead of calling repeatedly NB: Fixes copy/paste error wherein we display getenv(BSDINSTALL_DISTDIR) in an error msgbox when chdir(2) to getenv(BSDINSTALL_CHROOT) fails (wrong variable displayed in msgbox). + Use strtol(3) instead of [deprecated] atoi(3) + Add additional error checking (e.g., check return of archive_read_new(3)) + Assign DECONST strings to static variables + Fix typo in distextract.c error message (s/Could could/Could not/) + Add comments and make a minor whitespace adjustment Reviewed by: nwhitehorn, julian
Diffstat (limited to 'usr.sbin/bsdinstall/distfetch')
-rw-r--r--usr.sbin/bsdinstall/distfetch/distfetch.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/bsdinstall/distfetch/distfetch.c b/usr.sbin/bsdinstall/distfetch/distfetch.c
index 69ff1d0..4e870c8 100644
--- a/usr.sbin/bsdinstall/distfetch/distfetch.c
+++ b/usr.sbin/bsdinstall/distfetch/distfetch.c
@@ -82,7 +82,7 @@ main(void)
getenv("BSDINSTALL_DISTDIR"), strerror(errno));
dialog_msgbox("Error", error, 0, 0, TRUE);
end_dialog();
- return (1);
+ return (EXIT_FAILURE);
}
nfetched = fetch_files(ndists, urls);
@@ -94,7 +94,7 @@ main(void)
free(urls[i]);
free(urls);
- return ((nfetched == ndists) ? 0 : 1);
+ return ((nfetched == ndists) ? EXIT_SUCCESS : EXIT_FAILURE);
}
static int
OpenPOWER on IntegriCloud