libdwfl: linux-pid-attach.c (pid_next_thread): Use rewinddir on first call.

dwfl_getthreads would otherwise fail to report any threads after it was
called once.

Reported-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c
index 45a0732..3d0716a 100644
--- a/libdwfl/linux-pid-attach.c
+++ b/libdwfl/linux-pid-attach.c
@@ -164,6 +164,9 @@
 {
   struct pid_arg *pid_arg = dwfl_arg;
   struct dirent *dirent;
+  /* Start fresh on first traversal. */
+  if (*thread_argp == NULL)
+    rewinddir (pid_arg->dir);
   do
     {
       errno = 0;