commit:     4ec8b2852f194709aca48be26888fd52c0f09c2f
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 20 22:38:35 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Feb 20 22:38:35 2015 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/portage-utils.git;a=commit;h=4ec8b285

tests: atom_explode: update cache location

---
 tests/atom_explode/dotest | 4 ++--
 tests/atom_explode/test.c | 9 ++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/atom_explode/dotest b/tests/atom_explode/dotest
index 3b134e2..c4dc913 100755
--- a/tests/atom_explode/dotest
+++ b/tests/atom_explode/dotest
@@ -2,8 +2,8 @@
 
 . ../init.sh
 
-[[ $PORTDIR == "" ]] && PORTDIR=$(portageq envvar PORTDIR)
-pushd ${PORTDIR}/metadata/cache >/dev/null || { echo SKIPPED; exit 0 ; }
+: ${PORTDIR:=$(portageq envvar PORTDIR)}
+pushd "${PORTDIR}"/metadata/md5-cache >/dev/null || { echo SKIPPED; exit 0 ; }
 
 if [[ $1 == -v ]] ; then
        find . -mindepth 2 -type f -printf '%P\n%f\n' | while read line ; do

diff --git a/tests/atom_explode/test.c b/tests/atom_explode/test.c
index d9e80e7..ef05a69 100644
--- a/tests/atom_explode/test.c
+++ b/tests/atom_explode/test.c
@@ -29,12 +29,15 @@ int main(int argc, char *argv[])
                atom_implode(a);
        }
        if (argc == 1) {
-               char buf[1024], *p;
-               while (fgets(buf, sizeof(buf), stdin) != NULL) {
+               size_t buflen;
+               char *buf, *p;
+
+               buf = NULL;
+               while (getline(&buf, &buflen, stdin) != -1) {
                        if ((p = strchr(buf, '\n')) != NULL)
                                *p = '\0';
                        a = atom_explode(buf);
-                       boom(a,buf);
+                       boom(a, buf);
                        atom_implode(a);
                }
        }

Reply via email to