diff options
author | Matija Skala <mskala@gmx.com> | 2017-05-19 14:36:12 +0200 |
---|---|---|
committer | John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> | 2017-05-19 14:38:25 +0200 |
commit | 3bd7ef833caae7431a9c50450ce7b303234d45eb (patch) | |
tree | 1e143e35ea973902677798838400350631f82ab7 /src/basic/format-util.h | |
parent | cc9211b030c1fa7dd8d0e14df1de3e2aba32e50c (diff) | |
download | systemd-3bd7ef833caae7431a9c50450ce7b303234d45eb.tar.gz |
timesync/timesyncd-manager: fix format-specifier issues
timex::time::tv_usec and timex::freq can have different sizes
depending on the host architecture. On x32 in particular,
it is 8 bytes long while the long int type is only 4 bytes
long. Hence, using li as a format specifier will trigger
a format error. Thus, introduce a new format specifier
PRI_TIMEX which is defined as PRIi64 on x32 and li
everywhere else.
Diffstat (limited to 'src/basic/format-util.h')
-rw-r--r-- | src/basic/format-util.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/basic/format-util.h b/src/basic/format-util.h index 39a185f59b..ae42a8f89e 100644 --- a/src/basic/format-util.h +++ b/src/basic/format-util.h @@ -54,6 +54,12 @@ # error Unknown time_t size #endif +#if defined __x86_64__ && defined __ILP32__ +# define PRI_TIMEX PRIi64 +#else +# define PRI_TIMEX "li" +#endif + #if SIZEOF_RLIM_T == 8 # define RLIM_FMT "%" PRIu64 #elif SIZEOF_RLIM_T == 4 |