HomeClusterLabs Projects

Low: tools/findif: make ConvertQuadToInt use netmask_bits fnc

Description

Low: tools/findif: make ConvertQuadToInt use netmask_bits fnc

This is not only to simplify ConvertQuadToInt and practice DRY
principle, but also to make it a little bit safer. Because
of vague data types involved (instead of uint32_t at al.),
this at least adds one assurance and that is that the logic
will not get broken on architecture with 16bit int
(provided that long has still 32bit, which is not guaranteed
either).

Newly, failure of inet_pton (especially, malformed IP address
format) is indicated via -1 return value. Previously, such
case was not handled safely.

The patch also unifies tab usage (ConvertQuadToInt was the only
function using spaces for indentation).

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>

Details

Provenance
Jan Pokorný <jpokorny@redhat.com>Authored on Oct 4 2012, 6:23 AM
Parents
rR36c8b72bb8f0: Low: tools/findif: fix comment typos
Branches
Unknown
Tags
Unknown

Event Timeline