From: Bernd Porr Date: Sat, 19 Mar 2005 00:42:05 +0000 (+0000) Subject: Fixed a segfault. The fopen command needs a string and not an integer X-Git-Tag: v0_8_0~112 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7c0ab8f2acdfb3ac1e6800742686bacf82d2ed14;p=comedilib.git Fixed a segfault. The fopen command needs a string and not an integer as flag. Every entry in the filename arrary is initally initialised with "NULL". --- diff --git a/comedi_config/comedi_config.c b/comedi_config/comedi_config.c index 6bacdac..1b76c31 100644 --- a/comedi_config/comedi_config.c +++ b/comedi_config/comedi_config.c @@ -53,7 +53,7 @@ int write_buf_size=0; int init_fd; #define MAX_NUM_INIT_FILES 4 -char *init_file[MAX_NUM_INIT_FILES] = {NULL}; +char *init_file[MAX_NUM_INIT_FILES] = {NULL,NULL,NULL,NULL}; enum option_ids { @@ -128,12 +128,12 @@ void read_init_files(char* file_names[], int num_files, int *options) for(i = 0; i < num_files; ++i) { struct stat buf; - if(files[i] == NULL) + if(file_names[i] == NULL) { sizes[i] = 0; continue; } - files[i] = fopen(file_names[i], O_RDONLY); + files[i] = fopen(file_names[i],"r"); if(files[i] == NULL) { perror(file_names[i]);