malloc/Makefile: Split and sort tests
[glibc.git] / login / tst-utmp-unsigned.c
blob27ad03a7d608e83d471fd44949a87112e6789d04
1 /* Check that struct utmp, struct utmpx, struct lastlog use unsigned epoch.
2 Copyright (C) 2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <utmp.h>
20 #include <utmpx.h>
21 #include <utmp-size.h>
23 /* Undefined. Used to check that the conditions below are optimized away. */
24 void link_failure_utmp (void);
25 void link_failure_utmpx (void);
26 void link_failure_lastlog (void);
28 static int
29 do_test (void)
31 if ((struct utmp) { .ut_tv = { 0x80000000U, }, }.ut_tv.tv_sec <= 0)
32 link_failure_utmp ();
33 if ((struct utmpx) { .ut_tv = { 0x80000000U, }, }.ut_tv.tv_sec <= 0)
34 link_failure_utmpx ();
35 if ((struct lastlog) { .ll_time = 0x80000000U, }.ll_time <= 0)
36 link_failure_lastlog ();
37 return 0;
40 #include <support/test-driver.c>