On 2022-02-28 10:50:29 +0100, grischka wrote: > Christian Jullien wrote: > > Thanks, > > This is unfortunately not the only case where returned value is not tested, > > just for fdopen, if maintainers agree, we can probably apply: > > Wdyt? > > The rule is, as always: don't write code that you cannot test.
Various other error cases are probably not tested. Has anyone checked code coverage? Testing the code can be done once by adding "fp = NULL;" and checking that the error is correctly handled. Otherwise, perhaps with LD_PRELOAD to define a fdopen wrapper that will simulate an error for some calls. > Can you? > > Otherwise, can we stop suggesting sloppily crafted quick patches > addressing non-existent problems? fdopen() may fail. So this is a real problem. However, the check for errors should be done on the other related function calls too. Not checking errors may yield obscure errors in user code and/or data loss/corruption (this happened to me with GCC, which did not check some write errors, so that data were randomly silently missing on NFS and my scripts were failing with errors difficult to debug). -- Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
