Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: ports/glibc-compat/src/writev.c

Issue 1226403004: Added (libevent,tor) and modified glibc-compat (Closed) Base URL: https://chromium.googlesource.com/external/naclports.git@master
Patch Set: Resolved critical issues in libevent Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ports/glibc-compat/src/readv.c ('k') | ports/libevent/README » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* Copyright 2015 The Native Client Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. */
4
5 #include <sys/uio.h>
6 #include <unistd.h> // unix(nacl) standards
7 #include <errno.h>
8
9 ssize_t writev(int fd,const struct iovec *iov,int iovcnt){
10 if(iovcnt < 0){
11 // #TODO(dt) add check for IOV_MAX
12 errno = EINVAL;
13 return -1;
14 }
15 ssize_t bytes_written = 0 ;
16 ssize_t bytes_supposed_to_be_written = 0 ;
17 int i;
18 for (i = 0; i < (iovcnt); i++) {
19 bytes_written += write(fd, iov[i].iov_base, iov[i].iov_len);
20 bytes_supposed_to_be_written += iov[i].iov_len ;
21 // #TODO(dt) add check for (max) ssize_t allowed
22 if (bytes_written != bytes_supposed_to_be_written){
23 // deliberately not setting errno here as it might override
24 // errno set by write(...)
25 return -1;
26 }
27 }
28 return bytes_written;
29 }
OLDNEW
« no previous file with comments | « ports/glibc-compat/src/readv.c ('k') | ports/libevent/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698