Fixed a segfault. The fopen command needs a string and not an integer
authorBernd Porr <Bernd.Porr@f2s.com>
Sat, 19 Mar 2005 00:42:05 +0000 (00:42 +0000)
committerBernd Porr <Bernd.Porr@f2s.com>
Sat, 19 Mar 2005 00:42:05 +0000 (00:42 +0000)
as flag. Every entry in the filename arrary is initally initialised
with "NULL".

comedi_config/comedi_config.c

index 6bacdac9ba900da86c024d9d9f018b12ec85bcac..1b76c31112afb132f98cf5978bdbb56ba6c41a5e 100644 (file)
@@ -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]);