@@ -1071,7 +1071,7 @@ apply_handle_stream_commit(StringInfo s)
10711071nchanges = 0 ;
10721072while (true)
10731073{
1074- int nbytes ;
1074+ size_t nbytes ;
10751075int len ;
10761076
10771077CHECK_FOR_INTERRUPTS ();
@@ -1087,8 +1087,8 @@ apply_handle_stream_commit(StringInfo s)
10871087if (nbytes != sizeof (len ))
10881088ereport (ERROR ,
10891089(errcode_for_file_access (),
1090- errmsg ("could not read from streaming transaction's changes file \"%s\":%m " ,
1091- path )));
1090+ errmsg ("could not read from streaming transaction's changes file \"%s\":read only %zu of %zu bytes " ,
1091+ path , nbytes , sizeof ( len ) )));
10921092
10931093if (len <=0 )
10941094elog (ERROR ,"incorrect length %d in streaming transaction's changes file \"%s\"" ,
@@ -1098,11 +1098,12 @@ apply_handle_stream_commit(StringInfo s)
10981098buffer = repalloc (buffer ,len );
10991099
11001100/* and finally read the data into the buffer */
1101- if (BufFileRead (fd ,buffer ,len )!= len )
1101+ nbytes = BufFileRead (fd ,buffer ,len );
1102+ if (nbytes != len )
11021103ereport (ERROR ,
11031104(errcode_for_file_access (),
1104- errmsg ("could not read from streaming transaction's changes file \"%s\":%m " ,
1105- path )));
1105+ errmsg ("could not read from streaming transaction's changes file \"%s\":read only %zu of %zu bytes " ,
1106+ path , nbytes , ( size_t ) len )));
11061107
11071108/* copy the buffer to the stringinfo and call apply_dispatch */
11081109resetStringInfo (& s2 );
@@ -2710,6 +2711,7 @@ static void
27102711subxact_info_read (Oid subid ,TransactionId xid )
27112712{
27122713char path [MAXPGPATH ];
2714+ size_t nread ;
27132715Size len ;
27142716BufFile * fd ;
27152717StreamXidHash * ent ;
@@ -2742,13 +2744,12 @@ subxact_info_read(Oid subid, TransactionId xid)
27422744fd = BufFileOpenShared (ent -> subxact_fileset ,path ,O_RDONLY );
27432745
27442746/* read number of subxact items */
2745- if (BufFileRead (fd ,& subxact_data .nsubxacts ,
2746- sizeof (subxact_data .nsubxacts ))!=
2747- sizeof (subxact_data .nsubxacts ))
2747+ nread = BufFileRead (fd ,& subxact_data .nsubxacts ,sizeof (subxact_data .nsubxacts ));
2748+ if (nread != sizeof (subxact_data .nsubxacts ))
27482749ereport (ERROR ,
27492750(errcode_for_file_access (),
2750- errmsg ("could not read from streaming transaction's subxact file \"%s\":%m " ,
2751- path )));
2751+ errmsg ("could not read from streaming transaction's subxact file \"%s\":read only %zu of %zu bytes " ,
2752+ path , nread , sizeof ( subxact_data . nsubxacts ) )));
27522753
27532754len = sizeof (SubXactInfo )* subxact_data .nsubxacts ;
27542755
@@ -2766,11 +2767,15 @@ subxact_info_read(Oid subid, TransactionId xid)
27662767sizeof (SubXactInfo ));
27672768MemoryContextSwitchTo (oldctx );
27682769
2769- if ((len > 0 )&& ((BufFileRead (fd ,subxact_data .subxacts ,len ))!= len ))
2770+ if (len > 0 )
2771+ {
2772+ nread = BufFileRead (fd ,subxact_data .subxacts ,len );
2773+ if (nread != len )
27702774ereport (ERROR ,
27712775(errcode_for_file_access (),
2772- errmsg ("could not read from streaming transaction's subxact file \"%s\": %m" ,
2773- path )));
2776+ errmsg ("could not read from streaming transaction's subxact file \"%s\": read only %zu of %zu bytes" ,
2777+ path ,nread ,len )));
2778+ }
27742779
27752780BufFileClose (fd );
27762781}