FU: Less verbose and cryptic error message on write error

This commit is contained in:
Yorhel 2026-01-05 13:20:59 +01:00
parent 48fe393d5f
commit a7e9fa1866
2 changed files with 3 additions and 4 deletions

View file

@ -417,7 +417,7 @@ static void fufcgi_flush(pTHX_ fufcgi *ctx) {
hdr.type = FCGI_STDOUT; hdr.type = FCGI_STDOUT;
hdr.id = ctx->reqid; hdr.id = ctx->reqid;
if (fufcgi_write_record(ctx, &hdr, ctx->buf) != FUFE_OK) if (fufcgi_write_record(ctx, &hdr, ctx->buf) != FUFE_OK)
croak("write error: %s", strerror(errno)); croak("%s\n", strerror(errno));
ctx->len = 0; ctx->len = 0;
} }
} }
@ -442,13 +442,13 @@ static void fufcgi_done(pTHX_ fufcgi *ctx) {
hdr.type = FCGI_STDOUT; hdr.type = FCGI_STDOUT;
hdr.id = ctx->reqid; hdr.id = ctx->reqid;
if (fufcgi_write_record(ctx, &hdr, ctx->buf) != FUFE_OK) if (fufcgi_write_record(ctx, &hdr, ctx->buf) != FUFE_OK)
croak("write error: %s", strerror(errno)); croak("%s\n", strerror(errno));
memcpy(ctx->buf+8, "\0\0\0\0\0\0\0\0", 8); /* FCGI_REQUEST_COMPLETE */ memcpy(ctx->buf+8, "\0\0\0\0\0\0\0\0", 8); /* FCGI_REQUEST_COMPLETE */
hdr.type = FCGI_END_REQUEST; hdr.type = FCGI_END_REQUEST;
hdr.len = 8; hdr.len = 8;
if (fufcgi_write_record(ctx, &hdr, ctx->buf) != FUFE_OK) if (fufcgi_write_record(ctx, &hdr, ctx->buf) != FUFE_OK)
croak("write error: %s", strerror(errno)); croak("%s\n", strerror(errno));
ctx->reqid = ctx->len = ctx->off = 0; ctx->reqid = ctx->len = ctx->off = 0;
} }

View file

@ -180,7 +180,6 @@ record 1, 5, "";
isrec {'content-length','0'}, {body => ''}; isrec {'content-length','0'}, {body => ''};
$remote->close; $remote->close;
ok !eval { $f->flush; 1 }; ok !eval { $f->flush; 1 };
like $@, qr/write error/;
start; start;
begin; begin;