diff options
author | Alexander Kanavin <alex@linutronix.de> | 2023-08-22 14:02:16 +0200 |
---|---|---|
committer | Alexander Kanavin <alex@linutronix.de> | 2023-08-23 14:42:05 +0200 |
commit | 4c658af0b8524caaaa25a94f82c918e1bd7e8545 (patch) | |
tree | a317e32f7e1b605e51ac92a0d412c3f75ac5c19d /dbus/dbus-string.h | |
parent | 67a7ee7792d30f8f64ca2d517b1a9339c67ebed5 (diff) |
time: use dbus_int64_t for seconds instead of long
On 32 bit systems long will overflow in 2038, causing complete breakage.
This is confirmed by running dbus's test suite on a 32 bit system
with system time set to 2040 (and configured to use 64 bit time_t of course).
Note that both timespec and timeval are specified with time_t for the
seconds component. This should propagate everywhere where that data is
passed and stored, but previously _dbus_get_monotonic_time() and
_dbus_get_monotonic_time() would truncate it to long.
Also add a function for parsing dbus_int64_t from
files, as existing functions can only handle long.
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Diffstat (limited to 'dbus/dbus-string.h')
-rw-r--r-- | dbus/dbus-string.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/dbus/dbus-string.h b/dbus/dbus-string.h index 4689154f..be2434db 100644 --- a/dbus/dbus-string.h +++ b/dbus/dbus-string.h @@ -292,6 +292,11 @@ dbus_bool_t _dbus_string_parse_uint (const DBusString *str, unsigned long *value_return, int *end_return); DBUS_PRIVATE_EXPORT +dbus_bool_t _dbus_string_parse_int64 (const DBusString *str, + int start, + dbus_int64_t *value_return, + int *end_return); +DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_find (const DBusString *str, int start, const char *substr, |