From 664b2d68eba3e95d9936c8d21ec20681a10fa312 Mon Sep 17 00:00:00 2001 From: Egor Duda Date: Wed, 6 Sep 2000 14:21:53 +0000 Subject: Add 'const' qualifiers where needed to avoid compiler warnings. * libltp/lib/tst_sig.c (tst_sig): Don't attempt to cleanup on fatal errors. * libltp/lib/parse_opts.c (parse_opts): Initialize allocated string to prevent heap corruption. --- winsup/testsuite/libltp/lib/dataascii.c | 4 ++-- winsup/testsuite/libltp/lib/open_flags.c | 2 +- winsup/testsuite/libltp/lib/parse_opts.c | 8 +++++--- winsup/testsuite/libltp/lib/tst_res.c | 16 ++++++++-------- winsup/testsuite/libltp/lib/tst_sig.c | 10 +++++++++- 5 files changed, 25 insertions(+), 15 deletions(-) (limited to 'winsup/testsuite/libltp/lib') diff --git a/winsup/testsuite/libltp/lib/dataascii.c b/winsup/testsuite/libltp/lib/dataascii.c index 4b18e38b6..5bc201852 100644 --- a/winsup/testsuite/libltp/lib/dataascii.c +++ b/winsup/testsuite/libltp/lib/dataascii.c @@ -54,7 +54,7 @@ int offset; int ind; /* index into CHARS array */ char *chr; int chars_size; - char *charlist; + const char *charlist; chr=buffer; total=offset+bsize; @@ -90,7 +90,7 @@ char **errmsg; int ind; /* index into CHARS array */ char *chr; int chars_size; - char *charlist; + const char *charlist; chr=buffer; total=offset+bsize; diff --git a/winsup/testsuite/libltp/lib/open_flags.c b/winsup/testsuite/libltp/lib/open_flags.c index eed39ee33..3105955d4 100644 --- a/winsup/testsuite/libltp/lib/open_flags.c +++ b/winsup/testsuite/libltp/lib/open_flags.c @@ -109,7 +109,7 @@ static char Open_symbols[512]; /* space for openflags2symbols return value */ struct open_flag_t { - char *symbol; + const char *symbol; int flag; }; diff --git a/winsup/testsuite/libltp/lib/parse_opts.c b/winsup/testsuite/libltp/lib/parse_opts.c index 2758ebfb7..c40181395 100644 --- a/winsup/testsuite/libltp/lib/parse_opts.c +++ b/winsup/testsuite/libltp/lib/parse_opts.c @@ -144,8 +144,8 @@ static char *STD_start_break=0; /* original sbrk size */ static int Debug=0; struct std_option_t { - char *optstr; - char *help; + const char *optstr; + const char *help; char *flag; char **arg; } std_options[] = { @@ -197,7 +197,7 @@ static void usc_recressive_func(); /********************************************************************** * parse_opts: **********************************************************************/ -char * +const char * parse_opts(int ac, char **av, option_t *user_optarr, void (*uhf)()) { int found; /* flag to indicate that an option specified was */ @@ -236,6 +236,8 @@ parse_opts(int ac, char **av, option_t *user_optarr, void (*uhf)()) if (!optionstr) return "parse_opts: ERROR - Could not allocate memory for optionstr"; + optionstr[0] = '\0'; + for (i = 0; std_options[i].optstr; ++i) strcat(optionstr, std_options[i].optstr); if (user_optarr) diff --git a/winsup/testsuite/libltp/lib/tst_res.c b/winsup/testsuite/libltp/lib/tst_res.c index 394bc0403..7f0a003f3 100644 --- a/winsup/testsuite/libltp/lib/tst_res.c +++ b/winsup/testsuite/libltp/lib/tst_res.c @@ -153,7 +153,7 @@ */ static void check_env(); static void tst_condense(int tnum, int ttype, char *tmesg); -static void tst_print(char *tcid, int tnum, int trange, int ttype, char *tmesg); +static void tst_print(char *tcid, int tnum, int trange, int ttype, const char *tmesg); static void cat_file(char *filename); @@ -216,7 +216,7 @@ char *TESTDIR = NULL; * eventually get here to print the results. */ void -tst_res(int ttype, char *fname, char *arg_fmt, ...) +tst_res(int ttype, char *fname, const char *arg_fmt, ...) { int i; char tmesg[USERMESG]; /* expanded message */ @@ -407,7 +407,7 @@ tst_flush() * stream. */ static void -tst_print(char *tcid, int tnum, int trange, int ttype, char *tmesg) +tst_print(char *tcid, int tnum, int trange, int ttype, const char *tmesg) { char type[5]; @@ -581,7 +581,7 @@ tst_environ() * tests cases. */ void -tst_brk(int ttype, char *fname, void (*func)(), char *arg_fmt, ...) +tst_brk(int ttype, char *fname, void (*func)(), const char *arg_fmt, ...) { char tmesg[USERMESG]; /* expanded message */ @@ -652,7 +652,7 @@ tst_brk(int ttype, char *fname, void (*func)(), char *arg_fmt, ...) * remaining test cases within test case loop. */ void -tst_brkloop(int ttype, char *fname, void (*func)(), char *arg_fmt, ...) +tst_brkloop(int ttype, char *fname, void (*func)(), const char *arg_fmt, ...) { char tmesg[USERMESG]; /* expanded message */ @@ -727,7 +727,7 @@ tst_brkloop(int ttype, char *fname, void (*func)(), char *arg_fmt, ...) * tst_resm() - Interface to tst_res(), with no filename. */ void -tst_resm(int ttype, char *arg_fmt, ...) +tst_resm(int ttype, const char *arg_fmt, ...) { char tmesg[USERMESG]; /* expanded message */ @@ -752,7 +752,7 @@ tst_resm(int ttype, char *arg_fmt, ...) * tst_brkm() - Interface to tst_brk(), with no filename. */ void -tst_brkm(int ttype, void (*func)(), char *arg_fmt, ...) +tst_brkm(int ttype, void (*func)(), const char *arg_fmt, ...) { char tmesg[USERMESG]; /* expanded message */ @@ -777,7 +777,7 @@ tst_brkm(int ttype, void (*func)(), char *arg_fmt, ...) * tst_brkloopm() - Interface to tst_brkloop(), with no filename. */ void -tst_brkloopm(int ttype, void (*func)(), char *arg_fmt, ...) +tst_brkloopm(int ttype, void (*func)(), const char *arg_fmt, ...) { char tmesg[USERMESG]; /* expanded message */ diff --git a/winsup/testsuite/libltp/lib/tst_sig.c b/winsup/testsuite/libltp/lib/tst_sig.c index c0d5bbf46..cccc2c7ee 100644 --- a/winsup/testsuite/libltp/lib/tst_sig.c +++ b/winsup/testsuite/libltp/lib/tst_sig.c @@ -150,7 +150,15 @@ tst_sig(int fork_flag, void (*handler)(), void (*cleanup)()) #ifdef SIGPTRESCHED case SIGPTRESCHED: #endif /* SIGPTRESCHED */ - +#ifdef __CYGWIN__ + case SIGSEGV: + case SIGILL: + case SIGTRAP: + case SIGABRT: + case SIGEMT: + case SIGFPE: + case SIGBUS: +#endif break; case SIGCLD: -- cgit v1.2.3