__printerr which handles all error printing to STDERR_FILENO is not atomic

The function __printerr in file userland/lib/libc/unix/err.c is not atomic, it divides the write among multiple calls to the write syscall. This causes the output to be intermingled. Am I missing something, I have passed the ASST1 tests for read-writer locks and passed the file tests part of ASST2, my implementation of write should be correct, right ? I use reader-writer-locks to synchronize writing to STDERR and STDOUT.