Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdf10ac6

Browse files
committed
Don't use elog() in src/port/pwrite.c.
Nothing broke because of this oversight yet, but it would fail to linkif we tried to use pg_pwrite() in frontend code on a system that lackspwrite(). Use an assertion instead. Also pgindent while here.Discussion:https://postgr.es/m/CA%2BhUKGL57RvoQsS35TVPnQoPYqbtBixsdRhynB8NpcUKpHTTtg%40mail.gmail.com
1 parentee1b38f commitdf10ac6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎src/port/pwrite.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
7070
return-1;
7171
returnwritev(fd,iov,iovcnt);
7272
#else
73-
ssize_tsum=0;
74-
ssize_tpart;
73+
ssize_tsum=0;
74+
ssize_tpart;
7575

7676
for (inti=0;i<iovcnt;++i)
7777
{
@@ -137,14 +137,14 @@ pg_pwritev_with_retry(int fd, const struct iovec *iov, int iovcnt, off_t offset)
137137
/* Are they all done? */
138138
if (iovcnt==0)
139139
{
140-
if (part>0)
141-
elog(ERROR,"unexpectedly wrote more than requested");
140+
/* We don't expect the kernel to write more than requested. */
141+
Assert(part==0);
142142
break;
143143
}
144144

145145
/*
146-
* Move whatever's left to the front of our mutable copy and adjust the
147-
* leading iovec.
146+
* Move whatever's left to the front of our mutable copy and adjust
147+
*theleading iovec.
148148
*/
149149
Assert(iovcnt>0);
150150
memmove(iov_copy,iov,sizeof(*iov)*iovcnt);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp