diff options
author | Egor Duda <deo@logos-m.ru> | 2000-09-06 14:21:53 +0000 |
---|---|---|
committer | Egor Duda <deo@logos-m.ru> | 2000-09-06 14:21:53 +0000 |
commit | 664b2d68eba3e95d9936c8d21ec20681a10fa312 (patch) | |
tree | e6271d97288d679418f83a7ad9861de54f0a4dcf /winsup/testsuite/libltp/lib/parse_opts.c | |
parent | 94cb46cdf0ab32ab3ef40266b4e92c72e7c0f7b3 (diff) | |
download | cygnal-664b2d68eba3e95d9936c8d21ec20681a10fa312.tar.gz cygnal-664b2d68eba3e95d9936c8d21ec20681a10fa312.tar.bz2 cygnal-664b2d68eba3e95d9936c8d21ec20681a10fa312.zip |
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.
Diffstat (limited to 'winsup/testsuite/libltp/lib/parse_opts.c')
-rw-r--r-- | winsup/testsuite/libltp/lib/parse_opts.c | 8 |
1 files changed, 5 insertions, 3 deletions
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) |