[riot-notifications] [RIOT-OS/RIOT] cpu/native: make use of stdio_read() / stdio_write() (#16822)

Karl Fessel notifications at github.com
Tue Sep 21 16:56:48 CEST 2021


@kfessel commented on this pull request.



> @@ -249,13 +249,18 @@ ssize_t _native_writev(int fd, const struct iovec *iov, int iovcnt)
     ssize_t r = 0;
 
     if (fd == STDOUT_FILENO || fd == STDERR_FILENO) {
-        for (int i = 0; i < iovcnt; ++i) {
-            ssize_t res = stdio_write(iov->iov_base, iov->iov_len);
-            iov++;
-            if (res < 0) {
-                return res;
+        while (iovcnt--) {
+            size_t offset = 0;
+            while (iov->iov_len > offset) {
+                ssize_t res = stdio_write((void *)((uintptr_t)iov->iov_base + offset),
+                                          iov->iov_len - offset);
+                if (res < 0) {
+                    return res;

I am not sure about that since the the spec says on success which it does not define but the manpage does so. On the other hand the specs define the unsuccess (error) as the fd is not changed -> nothing is written?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16822#discussion_r713127483
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210921/36c77126/attachment-0001.htm>


More information about the notifications mailing list