diff options
author | graham.gower@gmail.com <graham.gower@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2010-11-15 17:47:28 (EST) |
---|---|---|
committer | graham.gower@gmail.com <graham.gower@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2010-11-15 17:47:28 (EST) |
commit | dcb875bea220d4eddd6b398046e91d3781083fe6 (patch) | |
tree | 92c16fc62cc1a3f9fe7a91ce5efe0a79983f858e /libopkg | |
parent | 039e4e5e6dbc0dde28dbd958078abc15c1c0d8b2 (diff) |
opkg_find_package() should not return garbage if it cannot find the package.
From juliosao via Issue #69.
git-svn-id: http://opkg.googlecode.com/svn/trunk@579 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg')
-rw-r--r-- | libopkg/opkg.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libopkg/opkg.c b/libopkg/opkg.c index b36dc1b..6d97789 100644 --- a/libopkg/opkg.c +++ b/libopkg/opkg.c @@ -778,6 +778,7 @@ pkg_t * opkg_find_package(const char *name, const char *ver, const char *arch, const char *repo) { + int pkg_found = 0; pkg_t *pkg = NULL; pkg_vec_t *all; int i; @@ -815,12 +816,13 @@ opkg_find_package(const char *name, const char *ver, const char *arch, } /* match found */ + pkg_found = 1; break; } pkg_vec_free(all); - return pkg; + return pkg_found ? pkg : NULL; } /** |