This patch fixes commit dcb54fafb128ab41772ae217afc6a7612e2cc446 which is broken on big endian, 64 bit machines. The data is stored in the upper 4 bytes of the pointer on these machines, but the code was reading the lower 4 bytes. This resulted in the first day of the week being reported incorrectly. Signed off by: Joseph Jezak <josejx@xxxxxxxxxx> --- misc-utils/cal.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/misc-utils/cal.c b/misc-utils/cal.c index 5444cea..3b20543 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -312,7 +312,10 @@ main(int argc, char **argv) { POSIX: 19971201 + 7 -1 = 0 */ { - int wfd = (int)(intptr_t) nl_langinfo(_NL_TIME_WEEK_1STDAY); + char *wfd_ptr = nl_langinfo(_NL_TIME_WEEK_1STDAY); + int *wfd_int_ptr = (int *)(&wfd_ptr); + int wfd = *wfd_int_ptr; + wfd = day_in_week(wfd % 100, (wfd / 100) % 100, wfd / (100 * 100)); weekstart = (wfd + *nl_langinfo(_NL_TIME_FIRST_WEEKDAY) - 1) % 7; } -- 1.6.6 -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html