Parcourir la source

Kernel: Return bytes written if sys$write() fails after writing some

If we wrote anything we should just inform userspace that we did,
and not worry about the error code. Userspace can call us again if
it wants, and we'll give them the error then.
Andreas Kling il y a 5 ans
Parent
commit
4badef8137
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      Kernel/Process.cpp

+ 2 - 2
Kernel/Process.cpp

@@ -1695,8 +1695,8 @@ ssize_t Process::do_write(FileDescription& description, const u8* data, int data
         dbg() << "   -> write returned " << rc;
         dbg() << "   -> write returned " << rc;
 #endif
 #endif
         if (rc < 0) {
         if (rc < 0) {
-            // FIXME: Support returning partial nwritten with errno.
-            ASSERT(nwritten == 0);
+            if (nwritten)
+                return nwritten;
             return rc;
             return rc;
         }
         }
         if (rc == 0)
         if (rc == 0)