Hi,
I found that crm_get_msec() is declared to return _unsigned_ long long,
but it tries to return a minus value in the following cases.
i) input strings consists of only character string.
ii) input strings means minus value.
In these cases, the return value is unexpected one like 1271310319.
I think this function should be declared to return _signed_ value,
but it is used in so many places without minus value check.
I tentatively created a patch , but I could'nt clarify its influence...
Anyway, I just want to use crm_get_msec()'s function safely.
If it is possible as it is, please let me know.
Regards,
Satomi Taniguchi
diff -urN org/include/crm/common/util.h mod/include/crm/common/util.h
--- org/include/crm/common/util.h 2008-09-09 10:58:39.000000000 +0900
+++ mod/include/crm/common/util.h 2008-09-09 13:00:52.000000000 +0900
@@ -75,7 +75,7 @@
extern int crm_str_to_boolean(const char * s, int * ret);
-extern unsigned long long crm_get_msec(const char * input);
+extern long long crm_get_msec(const char * input);
extern unsigned long long crm_get_interval(const char * input);
extern const char *op_status2text(op_status_t status);
diff -urN org/lib/common/utils.c mod/lib/common/utils.c
--- org/lib/common/utils.c 2008-09-09 10:58:39.000000000 +0900
+++ mod/lib/common/utils.c 2008-09-09 13:00:20.000000000 +0900
@@ -816,7 +816,7 @@
return msec * 1000;
}
-unsigned long long
+long long
crm_get_msec(const char * input)
{
const char * cp = input;
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/