set line buffering when stderr redirected to file

This commit is contained in:
stefan schippers 2023-01-20 18:25:43 +01:00
parent c8a60b4ee4
commit 6af6079084
4 changed files with 25 additions and 6 deletions

View File

@ -108,6 +108,7 @@ static void check_opt(char *opt, char *optval, int type)
} else if( (type == SHORT && *opt == 'l') || (type == LONG && !strcmp("log", opt)) ) {
if(optval) {
errfp = fopen(optval, "w");
setvbuf(errfp, NULL, _IOLBF, 0); /* line (_IOLBF) or disable (_IONBF) buffering on error log */
if(!errfp) {
errfp=stderr;
dbg(0, "Problems opening log file: %s\n", optval);

View File

@ -146,6 +146,10 @@ void ps_drawPNG(xRect* r, double x1, double y1, double x2, double y2, int rot, i
quality_attr = get_tok_value(r->prop_ptr, "jpeg_quality", 0);
if(quality_attr[0]) quality = atoi(quality_attr);
else {
quality_attr = get_tok_value(r->prop_ptr, "jpg_quality", 0);
if(quality_attr[0]) quality = atoi(quality_attr);
}
my_strdup(59, &filter, get_tok_value(r->prop_ptr, "filter", 0));
image_data_len = my_strdup2(1183, &image_data64_ptr, get_tok_value(r->prop_ptr, "image_data", 0));
@ -275,6 +279,11 @@ void ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, double ry2)
quality_attr = get_tok_value(r->prop_ptr, "jpeg_quality", 0);
if(quality_attr[0]) quality = atoi(quality_attr);
else {
quality_attr = get_tok_value(r->prop_ptr, "jpg_quality", 0);
if(quality_attr[0]) quality = atoi(quality_attr);
}
if(quality_attr[0]) quality = atoi(quality_attr);
if (!has_x) return;
rw = fabs(rx2 - rx1);
rh = fabs(ry2 - ry1);

View File

@ -548,6 +548,7 @@ void free_rawfile(int dr)
int i;
int deleted = 0;
dbg(1, "free_rawfile(): clearing data\n");
if(xctx->graph_names) {
deleted = 1;
for(i = 0 ; i < xctx->graph_nvars; i++) {

File diff suppressed because one or more lines are too long