Fix ignoring return values in C code