On Tue, Jan 17, 2012 at 10:18:00PM -0500, Chet Ramey wrote: > On 1/17/12 10:05 PM, Zachary Miller wrote: > >> Thanks for the report. As a practical matter, this doesn't present a > >> problem. When writing to a regular file, with no special flags supplied > >> to open(), the only cases Posix says it can return fewer bytes than > >> specified are errors. > > > > thank chet. i figured that may be the case. if you wouldn't mind, could > > you > > point me to where exactly that behavior is documented? > > Sure. That's how I read > > http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html#tag_16_879
thank you. for me, this is the line at issue: If write() is interrupted by a signal after it successfully writes some data, it shall return the number of bytes written. consider SIGSTOP, which is non-maskable. when the process continues, wouldn't this be a situation where the write was interrupted and thus could legitimately return fewer bytes? (btw, i agree that as a practical matter, this probably isn't anything to worry about, but i'm curious how others view this theoretical situation) cheers, -zach