mirror_corosync/tools/util.h
liangxin1300 fb5e0fae92 tools: use util_strtonum for options checking
Function atoi is not safe since miss validation;
Function strtol is better but need to consider empty string and overflows
Function util_strtonum is a safer wrapper of strtoll

Use util_strtonum to check nodeid option and strict checking condition.

Signed-off-by: liangxin1300 <XLiang@suse.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
2020-08-12 16:56:34 +02:00

16 lines
316 B
C

#ifndef COROSYNC_TOOLS_UTIL_H_DEFINED
#define COROSYNC_TOOLS_UTIL_H_DEFINED
#ifdef __cplusplus
extern "C" {
#endif
extern int util_strtonum(const char *str, long long int min_val,
long long int max_val, long long int *res);
#ifdef __cplusplus
}
#endif
#endif /* COROSYNC_TOOLS_UTIL_H_DEFINED */