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

Appearance settings

Commit df10ac6

Browse filesBrowse files
committed
Don't use elog() in src/port/pwrite.c.
Nothing broke because of this oversight yet, but it would fail to link if we tried to use pg_pwrite() in frontend code on a system that lacks pwrite(). Use an assertion instead. Also pgindent while here. Discussion: https://postgr.es/m/CA%2BhUKGL57RvoQsS35TVPnQoPYqbtBixsdRhynB8NpcUKpHTTtg%40mail.gmail.com
1 parent ee1b38f commit df10ac6
Copy full SHA for df10ac6

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed

‎src/port/pwrite.c

Copy file name to clipboardExpand all lines: src/port/pwrite.c
+6-6Lines 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
return writev(fd, iov, iovcnt);
7272
#else
73-
ssize_t sum = 0;
74-
ssize_t part;
73+
ssize_t sum = 0;
74+
ssize_t part;
7575

7676
for (int i = 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+
* the leading iovec.
148148
*/
149149
Assert(iovcnt > 0);
150150
memmove(iov_copy, iov, sizeof(*iov) * iovcnt);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.