#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
void read_file ( FILE * file ) {
size_t len = 0;
char * line = NULL;
ssize_t bytes_read;
while ( ( bytes_read = getline ( &line, &len, file ) ) != -1 ) {
printf ( line );
}
free ( line );
}
int main ( void ) {
FILE * file = fopen ( "/etc/fstab", "r" );
read_file ( file );
fclose ( file );
return 0;
}
Запускаем
tcc -run test.c
>> # /etc/fstab: static file system information.
>> Segmentation fault
size_t len = 0;
char * line = NULL;
ЗЫ баг уже отправил по почте