[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Segmentation violation in nested functions with kernel 1.35


I've just switched from kernel 2.6.11_1.27_FC3 to 2.6.11_1.35_FC3.
The following program makes a segmentation violation when I use the new
kernel.  When I switch back to the previous one, the program runs
without problems.

The problem occurs when the callback function is called (in
process_datas function).  Calling such a nested function should be ok,
when I read the gcc documentation.

Did I miss something ?
Thanks for your help.

#include <stdio.h>

struct context_t {
  int (*write_callback) ( FILE * output, char * buffer );

int process_datas ( struct context_t * context ) {

  return (  context->write_callback ( stdout, "write call back
datas" ));


int test ( void ) {

  struct context_t  context;

  int write_callback ( FILE * output, char * buffer ) {

    return (fprintf ( output, "%s\n", buffer ));

  context.write_callback = write_callback;

  return (process_datas ( &context ));

int main ( int argc, char ** argv ) {

  printf ("test result = %d\n", test());
  return (0);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]