summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2002-02-20 17:15:17 +0000
committersobomax <sobomax@FreeBSD.org>2002-02-20 17:15:17 +0000
commit15a3a8ab24f8a76f5293cd91ac933fdcef2c61b3 (patch)
tree4e0f0b8808d993d52917f587a7bef76c505719c6 /usr.sbin/pkg_install
parent8b827e221ad7c232bcbf206eedf136b902313689 (diff)
downloadFreeBSD-src-15a3a8ab24f8a76f5293cd91ac933fdcef2c61b3.zip
FreeBSD-src-15a3a8ab24f8a76f5293cd91ac933fdcef2c61b3.tar.gz
Make sortdeps() working with dependency lists containing one or no elements.
Submitted by: roam MFC in: 1 week
Diffstat (limited to 'usr.sbin/pkg_install')
-rw-r--r--usr.sbin/pkg_install/lib/deps.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/pkg_install/lib/deps.c b/usr.sbin/pkg_install/lib/deps.c
index ddb6da7..04f42b3 100644
--- a/usr.sbin/pkg_install/lib/deps.c
+++ b/usr.sbin/pkg_install/lib/deps.c
@@ -41,7 +41,10 @@ sortdeps(char **pkgs)
int i, j, loop_cnt;
int err_cnt = 0;
- for (i = 0; pkgs[i]; i++) {
+ if (pkgs[0] == NULL || pkgs[1] == NULL)
+ return (0);
+
+ for (i = 0; pkgs[i + 1]; i++) {
/*
* Check to see if any other package in pkgs[i+1:] depends
* on pkgs[i] and swap those two packages if so.
OpenPOWER on IntegriCloud