Open elfring opened 8 years ago
I don't really understand what this issue is exactly about, sorry. Please rephrase.
I think it means that the call to seek in posixfs_open doesn't check the return code and same for malloc in main and printf in init_compiler
I suggest to avoid ignorance of return values a bit more. Would you like to detect every error situation as early as possible?
Personally, I believe that error checking printf
is a tad overkill, with snprintf
however a must. Perhaps malloc
could be replaced with something like xmalloc
(which exits if malloc
threw an error because, well, there isn't much else you can do in that situation).
Other than that, more error handling in file and string functions would be great and if possible/sensible, the use of safer string functions. There's at least one occurrence of improperly null-terminated strings in the sources, for that pervasive use of snprintf
would be a good idea (combined with a warning if the limit is exceeded). I'll have to investigate what the situation with strlen
, strcpy
and strcmp
is.
Would you like to add more error handling for return values from functions like the following?