Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/usr.sbin/sysinst/util.c,v rcsdiff: /ftp/cvs/cvsroot/src/usr.sbin/sysinst/util.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.7.8.3 retrieving revision 1.8 diff -u -p -r1.7.8.3 -r1.8 --- src/usr.sbin/sysinst/util.c 2018/07/12 15:18:45 1.7.8.3 +++ src/usr.sbin/sysinst/util.c 2018/05/18 12:23:22 1.8 @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.7.8.3 2018/07/12 15:18:45 martin Exp $ */ +/* $NetBSD: util.c,v 1.8 2018/05/18 12:23:22 joerg Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1010,15 +1010,16 @@ get_and_unpack_sets(int update, msg setu /* Accurately count selected sets */ for (dist = dist_list; (set = dist->set) != SET_LAST; dist++) { - if (dist->name == NULL) - continue; if ((set_status[set] & (SET_VALID | SET_SELECTED)) == (SET_VALID | SET_SELECTED)) tarstats.nselected++; } status = SET_RETRY; - for (dist = dist_list; (set = dist->set) != SET_LAST; dist++) { + for (dist = dist_list; ; dist++) { + set = dist->set; + if (set == SET_LAST) + break; if (dist->name == NULL) continue; if (set_status[set] != (SET_VALID | SET_SELECTED)) @@ -1680,16 +1681,14 @@ set_menu_select(menudesc *m, void *arg) int binary_available(const char *prog) { - char *p, tmp[MAXPATHLEN], *path = getenv("PATH"), *opath; + char *p, tmp[MAXPATHLEN], *path = getenv("PATH"); if (path == NULL) return access(prog, X_OK) == 0; path = strdup(path); if (path == NULL) return 0; - - opath = path; - + while ((p = strsep(&path, ":")) != NULL) { if (strlcpy(tmp, p, MAXPATHLEN) >= MAXPATHLEN) continue; @@ -1698,11 +1697,11 @@ binary_available(const char *prog) if (strlcat(tmp, prog, MAXPATHLEN) >= MAXPATHLEN) continue; if (access(tmp, X_OK) == 0) { - free(opath); + free(path); return 1; } } - free(opath); + free(path); return 0; }