Skip to content

Commit 24c3e60

Browse files
committed
modify_ldt03: Fix compilation.
Fix compilation when struct user_desc is not defined in asm/ldt.h. NOTE: It would be better to move the user_desc fallback definition from modify_ldt01.c to a header in lapi/ and use that instead of the hardcoded definition. Signed-off-by: Cyril Hrubis <[email protected]>
1 parent f85e3b3 commit 24c3e60

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

testcases/kernel/syscalls/modify_ldt/modify_ldt03.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ int TST_TOTAL = 1;
2828
#if defined(__i386__) && defined(HAVE_MODIFY_LDT)
2929

3030
#ifdef HAVE_ASM_LDT_H
31-
#include <asm/ldt.h>
31+
# include <asm/ldt.h>
3232
#endif
3333
extern int modify_ldt(int, void *, unsigned long);
3434

@@ -38,7 +38,13 @@ extern int modify_ldt(int, void *, unsigned long);
3838
#include <errno.h>
3939
#include "safe_macros.h"
4040

41-
static char buf[sizeof(struct user_desc)];
41+
#ifdef HAVE_STRUCT_USER_DESC
42+
# define SIZE sizeof(struct user_desc)
43+
#else
44+
# define SIZE 16
45+
#endif
46+
47+
static char buf[SIZE];
4248
static void cleanup(void);
4349
static void setup(void);
4450

@@ -57,7 +63,7 @@ int main(int ac, char **av)
5763

5864
tst_count = 0;
5965

60-
TEST(modify_ldt(0, buf, sizeof(struct user_desc)));
66+
TEST(modify_ldt(0, buf, SIZE));
6167

6268
if (TEST_RETURN < 0) {
6369
tst_resm(TFAIL | TTERRNO,

0 commit comments

Comments
 (0)