This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
While working on ia64, I found out __exit_funcs->idx could be 0. It happens due to 1999-10-10 Ulrich Drepper <drepper@cygnus.com> * stdlib/atexit.c (initial): New variable. Use to initialize __exit_funcs. * stdlib/exit.c (exit): Beware to not free statically allocated list element [PR libc/1305]. In stdlib/exit.c, there is while (__exit_funcs != NULL) { ... do { f = &__exit_funcs->fns[--__exit_funcs->idx]; ... } while (__exit_funcs != NULL); } It was ok since __exit_funcs was NULL if atexit () was never called before the change. Since now __exit_funcs is initialized to initial regardless if atexit is called. __exit_funcs->idx may be 0. This patch seems to work for me. Any comments? Thanks. -- H.J. Lu (hjl@gnu.org) -- Thu Nov 25 09:40:15 1999 H.J. Lu <hjl@gnu.org> * stdlib/exit.c (exit): Run funtions only if __exit_funcs->idx > 0. --- /work/gnu/import/glibc-2.1/libc/stdlib/exit.c Thu Oct 21 14:54:09 1999 +++ stdlib/exit.c Thu Nov 25 09:38:24 1999 @@ -41,7 +41,7 @@ exit (int status) { struct exit_function_list *old; - do + while (__exit_funcs->idx > 0) { const struct exit_function *const f = &__exit_funcs->fns[--__exit_funcs->idx]; @@ -58,7 +58,6 @@ exit (int status) break; } } - while (__exit_funcs->idx > 0); old = __exit_funcs; __exit_funcs = __exit_funcs->next;
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |