Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.unix.programmer > #13636

Re: How to check for error with write(2)

From Steve Keller <keller.steve@gmx.de>
Newsgroups comp.unix.programmer
Subject Re: How to check for error with write(2)
Date 2021-12-17 04:38 +0100
Organization Aioe.org NNTP Server
Message-ID <sph0n9$1vmq$1@gioia.aioe.org> (permalink)
References <spfuo5$lb0$1@gioia.aioe.org> <slrnsrnfmu.1rfm.grahn+nntp@frailea.sa.invalid>

Show all headers | View raw


Jorgen Grahn <grahn+nntp@snipabacken.se> writes:

> The OpenBSD one is similar. Are you talking about other Unix-like
> systems, or are you saying the man page is wrong?  Because it seems to
> say that in your scenario, the fatal write() will return -1 and set
> EFBIG.

I should have written more clearly, that I was talking about a "short
write".  I.e. the write() syscall doesn't return -1 and doesn't set
errno, but it could only write data partially.

I wasn't saying the man page is wrong, only that an error can occur
without write() returning -1 to indicate the error.  Repeating the
write() with the rest of the data to get the error, as Philip
suggested, was obviously too simple for me to get that idea :-)

> Until I'm convinced it's wrong: according to the write(2) man page.
> 
> (I'm disregarding the fsync(2) angle, covered by others.)

Yes, f*sync() is not what I was looking for.

Steve

Back to comp.unix.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to check for error with write(2) Steve Keller <keller.steve@gmx.de> - 2021-12-16 18:58 +0100
  Re: How to check for error with write(2) scott@slp53.sl.home (Scott Lurndal) - 2021-12-16 18:26 +0000
    Re: How to check for error with write(2) Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2021-12-20 13:52 +0000
  Re: How to check for error with write(2) Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2021-12-16 18:49 +0000
    Re: How to check for error with write(2) Rainer Weikusat <rweikusat@talktalk.net> - 2021-12-16 19:00 +0000
  Re: How to check for error with write(2) Rainer Weikusat <rweikusat@talktalk.net> - 2021-12-16 19:06 +0000
  Re: How to check for error with write(2) Jorgen Grahn <grahn+nntp@snipabacken.se> - 2021-12-16 22:34 +0000
    Re: How to check for error with write(2) Steve Keller <keller.steve@gmx.de> - 2021-12-17 04:38 +0100
      Re: How to check for error with write(2) Rainer Weikusat <rweikusat@talktalk.net> - 2021-12-17 15:14 +0000
      Re: How to check for error with write(2) Jorgen Grahn <grahn+nntp@snipabacken.se> - 2021-12-18 10:25 +0000
  Re: How to check for error with write(2) Philip Guenther <guenther@gmail.com> - 2021-12-16 15:04 -0800
    Re: How to check for error with write(2) Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2021-12-16 20:10 -0700
    Re: How to check for error with write(2) Steve Keller <keller.steve@gmx.de> - 2021-12-17 04:35 +0100
      Re: How to check for error with write(2) Philip Guenther <guenther@gmail.com> - 2021-12-18 14:58 -0800
        Re: How to check for error with write(2) scott@slp53.sl.home (Scott Lurndal) - 2021-12-19 16:07 +0000

csiph-web