ceph_erasure_code_benchmark.cc: don't check unsigned for < 0

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
net_handler.cc: close socket leak

Close socket if set_nonblock() fails before return.

Fix for:

CID 1249633 (#1 of 1): Resource leak (RESOURCE_LEAK)
7. leaked_handle: Handle variable s going out of scope leaks the handle.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
net_handler.cc: close another socket leak

Close socket if ::setsockopt() fails before return.

Fix for:

CID 1249632 (#1 of 1): Resource leak (RESOURCE_LEAK)
9. leaked_handle: Handle variable s going out of scope leaks the handle.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
st_rados_list_objects.cc: free resources in error case

Fix for:

CID 1251453 (#2 of 2): Resource leak (RESOURCE_LEAK)
 leaked_storage: Variable io_ctx going out of scope leaks the
 storage it points to.

CID 1251454 (#1 of 1): Resource leak (RESOURCE_LEAK)
 leaked_storage: Variable h going out of scope leaks the storage it
 points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
MDSMonitor.cc: remove cmd_getval for poolid

Remove useless check for invalid parameter for
"mds remove_data_pool", we have already the poolid
from the correct parameter 'poolname'.

Fix for:

CID 1251445 (#1 of 1): Unchecked return value (CHECKED_RETURN)
 check_return: Calling cmd_getval without checking return value
 (is done elsewhere 19 out of 22 times).

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ceph_authtool.cc: catch ceph::buffer::end_of_buffer exception

Fix for:

CID 717142 (#1 of 1): Uncaught exception (UNCAUGHT_EXCEPT)
 root_function: In function main(int, char const **) an exception
 of type ceph::buffer::end_of_buffer is thrown and never caught.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ceph_authtool.cc: catch ceph::FailedAssertion exception

Fix for:

CID 717141 (#1-19): Uncaught exception (UNCAUGHT_EXCEPT)
 root_function: In function main(int, char const **) an exception
 of type ceph::FailedAssertion is thrown and never caught.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
dupstore.cc: ceph::FailedAssertion exception

CID 717156 (#1-5): Uncaught exception (UNCAUGHT_EXCEPT)
 root_function: In function main(int, char const **) an exception
 of type ceph::FailedAssertion is thrown and never caught.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
librados-config.cc: catch ceph::FailedAssertion exception

CID 717157 (#1-2): Uncaught exception (UNCAUGHT_EXCEPT)
 root_function: In function main(int, char const **) an exception
 of type ceph::FailedAssertion is thrown and never caught.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
tools/psim.cc: catch ceph::buffer::end_of_buffer exception

Fix for:

CID 717163 (#1 of 1): Uncaught exception (UNCAUGHT_EXCEPT)
 root_function: In function main(int, char **) an exception of type
 ceph::buffer::end_of_buffer is thrown and never caught.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
c_read_operations.cc: prevent potential null pointer deref

CID 1251575 (#1 of 1): Dereference after null check (FORWARD_NULL)
 var_deref_model: Passing null pointer key to basic_string, which
 dereferences it.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
os/FileJournal.cc: fix potential use after close cases

Fix checks after _open() calls to make sure to use the
filehandle only if open returns '0'.

Fix for:

CID 1128395 (#1 of 1): Use after close (USE_AFTER_FREE)
 pass_closed_arg: Passing closed handle this->fd as an argument
 to pwrite.

CID 1128396 (#1 of 2): Use after close (USE_AFTER_FREE)
 pass_closed_arg: Passing closed handle this->fd as an argument
 to read_header.

CID 1128397 (#1 of 1): Use after close (USE_AFTER_FREE)
 pass_closed_arg: Passing closed handle this->fd as an argument
 to read_header.

CID 1128398 (#1 of 1): Use after close (USE_AFTER_FREE)
 pass_closed_arg: Passing closed handle this->fd as an argument
 to read_header.

CID 1128400 (#1 of 1): Use after close (USE_AFTER_FREE)
 pass_closed_arg: Passing closed handle this->fd as an argument
 to read_header.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>