> (e.g. closing a file), there's generally not much you can do anyway
If closing a file fails then you treat it the same as how you would treat a write failure:
int err = 1;
FILE *f = fopen("whatever.txt", "w");
if(f){
if(5 == fwrite("Hello", 1, 5, f))
err = 0;
if(0 != fclose(f))
err = 1;
}
return err;
Code which writes to files and doesn't check for errors on close is subtly incorrect, although my understanding is that kernel devs bend over backwards to make failure unlikely, probably because everybody does it incorrectly anyway.