Segfault с stderr - PullRequest
       28

Segfault с stderr

0 голосов
/ 13 ноября 2010

У меня в моем коде ошибка в странном месте.Это в последнем заявлении if.У кого-нибудь есть идея, почему я получаю segfault?

void processArgument(char argument[]){
    FILE *sketcher;
    FILE *fp;
    fp = fopen (argument, "r");
    sketcher = popen(Exec_c, "w");
 if (fp == NULL){
        printf ("Could not open pipe to %s\n", argument);
  exit (EXIT_FAILURE);
 }
    if (sketcher == NULL){
        printf ("Could not open pipe to %s\n", argument);
  exit (EXIT_FAILURE);
    }else{
        parseFile(fp, sketcher);
        if(fclose(fp)==EOF){
   printf("couldn't close pipe to %s.\n", argument);
   exit(EXIT_FAILURE);
  }
        if (pclose(sketcher) == -1){                                                 //if (pclose(sketcher) == -1){
            fprintf(stderr, "draw_line error: couldn't close pipe to %s.\n", Exec_c);//fprintf(stderr,"",E);
            exit(EXIT_FAILURE);    
        }
    }
} 

1 Ответ

3 голосов
/ 13 ноября 2010

Самая простая возможность - Exec_c - недопустимая строка.

...