librados: simplify/fix rados_pool_list bounds checks

We were not breaking out of the loop when we filled up the buffer unless
we happened to do so on a pool name boundary.  This means that len would
roll over (it was unsigned).  In my case, I was not able to reproduce
anything particularly bad since (I think) the strncpy was interpreting the
large unsigned value as signed, but in any case this fixes it, simplifies
the arithmetic, and adds a simple test.

- use a single 'rl' value for the amount of buffer space we want to
  consume
- use this to check that there is room and also as the strncat length
- rely on the initial memset to ensure that the trailing 0 is in place.

Fixes: #8447
Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #1910 from ceph/wip-8447

librados: simplify/fix rados_pool_list bounds checks

Reviewed-by: Loic Dachary <loic@dachary.org>
include/atomic: make 32-bit atomic64_t unsigned

This fixes

In file included from test/perf_counters.cc:19:0:
./common/perf_counters.h: In member function ‘std::pair PerfCounters::perf_counter_data_any_d::read_avg() const’:
warning: ./common/perf_counters.h:156:36: comparison between signed and unsigned integer expressions [-Wsign-compare]
} while (avgcount2.read() != count);
^

Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #1925 from ceph/wip-i386-atomic

fix i386 atomic64_t

Reviewed-by: Samuel Just <sam.just@inktank.com>
Merge remote-tracking branch 'gh/next'