-
Daan Vreeken authored
When the .ctrl file contains a line to create an 'ec' block with incorrect arguments, the following errors would be emitted : ERROR: Invalid arguments trying to create block 'ethercat' DEBUG: Load module 'ec' with prefix 'ethercat' ERROR: ec:1: syntax error, unexpected $end DEBUG: End of module 'ec': 1 ERROR: pand.ctrl:50: Error creating block ERROR: Could not load controller file The code would first try to load the dynamically loadable 'ec' block's module. This would fail, because of incorrect arguments. controller_load_block_create() would then try to stat() the file 'ec'. When found, it is opened and loaded as a module block. The code didn't check for the file to be a regular file and my build system contains a directory with the name 'ec'. On FreeBSD, directories can be opened and read as if they were regular files, but the .ctrl file parser would fail to load the directory. Change the code to *not* try to parse directories. (It would be even better if we just stopped trying to load blocks when controller_block_create() tells us that the block does exist, but the user has made an error. At this moment though, controller_block_create() has no way of telling the caller that.) The new code bails out with : ERROR: Invalid arguments trying to create block 'ethercat' ERROR: Could not load or create block 'ec' ERROR: pand.ctrl:50: Error creating block ERROR: Could not load controller file modified: controller/controller/controller_load.c
73a5252d