Tighten error handling of string printing.
This commit is contained in:
@@ -532,7 +532,11 @@ eval_code(co, globals, locals, arg)
|
||||
char *s = getstringvalue(v);
|
||||
int len = getstringsize(v);
|
||||
fwrite(s, 1, len, fp);
|
||||
if (len > 0 && s[len-1] == '\n')
|
||||
if (ferror(fp)) {
|
||||
err_errno(IOError);
|
||||
err = -1;
|
||||
}
|
||||
else if (len > 0 && s[len-1] == '\n')
|
||||
softspace(sysget("stdout"), 0);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user