search for: xwrite

Displaying 20 results from an estimated 45 matches for "xwrite".

Did you mean: write
2023 Feb 15
1
[libnbd PATCH v3 07/29] lib/utils: add async-signal-safe assert()
...lt) > + return; Since no code should ever directly call nbd_internal_fork_safe_assert(0,...), but instead go through our macro that has already filtered on expression's value, this conditional is technically dead code; but I'm okay whether it stays in or gets removed. > + > + xwrite (STDERR_FILENO, file, strlen (file)); > + xwrite (STDERR_FILENO, ":", 1); Presumably, if our first best-effort xwrite() fails to produce full output, all later xwrite() will hopefully hit the same error condition so that we aren't producing even more-mangled output where later sy...
2023 Feb 21
1
[libnbd PATCH v3 07/29] lib/utils: add async-signal-safe assert()
On 2/20/23 19:21, Laszlo Ersek wrote: > On 2/15/23 21:57, Eric Blake wrote: >> On Wed, Feb 15, 2023 at 03:11:36PM +0100, Laszlo Ersek wrote: >>> + >>> + xwrite (STDERR_FILENO, file, strlen (file)); >>> + xwrite (STDERR_FILENO, ":", 1); >> >> Presumably, if our first best-effort xwrite() fails to produce full >> output, all later xwrite() will hopefully hit the same error condition >> so that we aren't produc...
2023 Feb 20
2
[libnbd PATCH v3 07/29] lib/utils: add async-signal-safe assert()
...n the first argument of that function call: nbd_internal_fork_safe_assert ((expression) != 0, ... So I think the early return is definitely necessary here. > this conditional is > technically dead code; but I'm okay whether it stays in or gets > removed. > >> + >> + xwrite (STDERR_FILENO, file, strlen (file)); >> + xwrite (STDERR_FILENO, ":", 1); > > Presumably, if our first best-effort xwrite() fails to produce full > output, all later xwrite() will hopefully hit the same error condition > so that we aren't producing even more-mangl...
2023 Feb 24
1
[libnbd PATCH v3 07/29] lib/utils: add async-signal-safe assert()
On 2/21/23 07:33, Laszlo Ersek wrote: > On 2/20/23 19:21, Laszlo Ersek wrote: >> On 2/15/23 21:57, Eric Blake wrote: >>> On Wed, Feb 15, 2023 at 03:11:36PM +0100, Laszlo Ersek wrote: > >>>> + >>>> + xwrite (STDERR_FILENO, file, strlen (file)); >>>> + xwrite (STDERR_FILENO, ":", 1); >>> >>> Presumably, if our first best-effort xwrite() fails to produce full >>> output, all later xwrite() will hopefully hit the same error condition >>> so that...
2009 Aug 20
1
[PATCH libguestfs] daemon: diagnose socket write failure
...les changed, 5 insertions(+), 3 deletions(-) diff --git a/daemon/proto.c b/daemon/proto.c index 9b33902..c2dd50c 100644 --- a/daemon/proto.c +++ b/daemon/proto.c @@ -495,8 +495,10 @@ send_chunk (const guestfs_chunk *chunk) xdr_uint32_t (&xdr, &len); xdr_destroy (&xdr); - (void) xwrite (sock, lenbuf, 4); - (void) xwrite (sock, buf, len); + int err = (xwrite (sock, lenbuf, 4) == 0 + && xwrite (sock, buf, len) == 0 ? 0 : -1); + if (err) + fprintf (stderr, "send_chunk: write failed\n"); - return 0; + return err; } -- 1.6.4.378.g88f2f
2016 Apr 04
0
[PATCH 2/2] Use 'error' function for fprintf followed by exit.
...age_error (&xdr, &err)) + error (EXIT_FAILURE, 0, "failed to encode error message body"); len = xdr_getpos (&xdr); xdr_destroy (&xdr); @@ -320,14 +311,10 @@ send_error (int errnum, char *msg) xdr_u_int (&xdr, &len); xdr_destroy (&xdr); - if (xwrite (sock, lenbuf, 4) == -1) { - fprintf (stderr, "guestfsd: xwrite failed\n"); - exit (EXIT_FAILURE); - } - if (xwrite (sock, buf, len) == -1) { - fprintf (stderr, "guestfsd: xwrite failed\n"); - exit (EXIT_FAILURE); - } + if (xwrite (sock, lenbuf, 4) == -1) + er...
2009 Nov 20
1
fix new failures from latest-from-gnulib syntax-check
...libguestfs redhat com mailing list.\n" "\n", vmchannel); - exit (1); + exit (EXIT_FAILURE); } /* Send the magic length message which indicates that @@ -304,7 +304,7 @@ main (int argc, char *argv[]) xdr_uint32_t (&xdr, &len); if (xwrite (sock, lenbuf, sizeof lenbuf) == -1) - exit (1); + exit (EXIT_FAILURE); xdr_destroy (&xdr); @@ -312,14 +312,14 @@ main (int argc, char *argv[]) if (!dont_fork) { if (daemon (0, 1) == -1) { perror ("daemon"); - exit (1); + exit (EXIT_FAILURE); }...
2012 Dec 13
2
[PATCH 1/2] daemon: NFC Use symbolic names in commandrvf
...stdin_fd[PIPE_WRITE]); if (chroot (sysroot) == -1) { perror ("chroot"); @@ -884,7 +888,7 @@ commandrvf (char **stdoutput, char **stderror, int flags, ssize_t n; char buffer[BUFSIZ]; while ((n = read (fd, buffer, sizeof buffer)) > 0) { - if (xwrite (1, buffer, n) == -1) + if (xwrite (STDOUT_FILENO, buffer, n) == -1) /* EPIPE error indicates the command process has exited * early. If the command process fails that will be caught * by the daemon, and if not, then it's not an error. @@ -906,23 +910,...
2009 Aug 18
8
src/ is now warning-free, too
These patches first make src/ warning free, and then turn on the strict warning options. 75 0001-build-suppress-an-ignored-write-return-value-warning.patch 38 0002-build-suppress-an-ignored-dup-return-value-warning.patch 27 0003-generator.ml-suppress-signed-unsigned-compare-warnin.patch 48 0004-build-don-t-perform-arithmetic-on-void-pointers.patch 30
2012 Jan 24
14
[PATCH 00/14] Run the daemon under valgrind and fix resultant errors.
This patch series lets you run the daemon under valgrind. Many errors were found and fixed. With the complete series applied, valgrind doesn't show any errors.
2016 Apr 04
2
[PATCH 1/2] Use 'error' function consistently throughout.
...perror (channel); - exit (EXIT_FAILURE); + error (EXIT_FAILURE, errno, "open: %s", channel); } } } @@ -353,10 +353,8 @@ main (int argc, char *argv[]) xdrmem_create (&xdr, lenbuf, sizeof lenbuf, XDR_ENCODE); xdr_u_int (&xdr, &len); - if (xwrite (sock, lenbuf, sizeof lenbuf) == -1) { - perror ("xwrite"); - exit (EXIT_FAILURE); - } + if (xwrite (sock, lenbuf, sizeof lenbuf) == -1) + error (EXIT_FAILURE, errno, "xwrite"); xdr_destroy (&xdr); diff --git a/daemon/ntfsclone.c b/daemon/ntfsclone.c index...
2016 Sep 26
1
[PATCH] nbdkit: flags are 32 bits for oldstyle connections
...0, sizeof handshake); memcpy (handshake.nbdmagic, "NBDMAGIC", 8); handshake.version = htobe64 (OLD_VERSION); handshake.exportsize = htobe64 (exportsize); - handshake.gflags = htobe16 (gflags); - handshake.eflags = htobe16 (eflags); + handshake.flags = htobe32 (flags); if (xwrite (conn->sockout, &handshake, sizeof handshake) == -1) { nbdkit_error ("write: %m"); diff -r d7d5078d08c7 -r dbd1ea0a401c src/protocol.h --- a/src/protocol.h Sun Sep 25 05:04:02 2016 +0200 +++ b/src/protocol.h Mon Sep 26 17:28:54 2016 +0200 @@ -41,8 +41,7 @@ char nbdmagic[8];...
2009 Aug 17
13
total warning-removal for daemon/
The warnings in daemon were aggravating and risky for development (too easy to miss new ones) so I spent some time last week and today working on removing them. The first patch gets us down to almost no warnings with the original -Wall setting. That was by far the hardest part. Once I'd done that, I enabled nearly all of gcc's warnings via gnulib's warnings and manywarnings modules
2009 Aug 21
9
enable -Werror and all of gcc's warning options
Here is a bunch of small patches to make fish/ build with most warnings enabled: [1/9] edit.c: avoid warning about signed/unsigned comparison [2/9] fish.c: avoid warnings [3/9] tilde.c: avoid a warning [4/9] fish.c: avoid "assignment discards qualifiers..." warning [5/9] fish.c: avoid signed/unsigned-comparison warning [6/9] fish.c: don't perform arithmetic on void*
2013 Mar 07
4
[PATCH 0/4] Small refactorings of the protocol layer.
As the start of work to add remote support, I'm taking a close look at the protocol layer in the library. These are some small cleanups. Rich.
2016 Jan 11
1
[PATCH] Add support for newstyle NBD protocol (RHBZ#1297100).
Experimental and only very lightly tested so far. Rich.
2023 Mar 15
4
[libnbd PATCH v4 0/3] lib/utils: add async-signal-safe assert()
This is version 4 of the following sub-series: [libnbd PATCH v3 06/29] lib/utils: introduce xwrite() as a more robust write() [libnbd PATCH v3 07/29] lib/utils: add async-signal-safe assert() [libnbd PATCH v3 08/29] lib/utils: add unit test for async-signal-safe assert() http://mid.mail-archive.com/20230215141158.2426855-7-lersek at redhat.com http://mid.mail-archive.com/20230215141158.2426855-...
2019 Sep 01
11
[nbdkit PATCH 00/10] Avoid -Wshadow
While working on can_FOO caching, at one point I got confused by whether 'readonly' meant the global set by -r or a local passed to .open(). A quick attempt to compile with -Wshadow found several other confusing points; this series gets us to the point that we can add -Wshadow to builds with --enable-gcc-warnings. Eric Blake (10): server: Avoid -Wshadow warnings guestfs: Avoid
2019 Jan 25
0
[klibc:update-dash] [OUTPUT] Add ifdefs around MEM_OUT handling in outmem
...oc; } else if (dest->fd == MEM_OUT) { offset = bufsize; @@ -169,6 +172,7 @@ buffered: if (bufsize < offset) goto err; alloc: +#endif INTOFF; dest->buf = ckrealloc(dest->buf, bufsize); dest->bufsize = bufsize; @@ -184,7 +188,9 @@ alloc: goto buffered; if ((xwrite(dest->fd, p, len))) { +#ifdef notyet err: +#endif dest->flags |= OUTPUT_ERR; } #endif
2020 Mar 28
0
[klibc:update-dash] dash: [OUTPUT] Add ifdefs around MEM_OUT handling in outmem
...oc; } else if (dest->fd == MEM_OUT) { offset = bufsize; @@ -169,6 +172,7 @@ buffered: if (bufsize < offset) goto err; alloc: +#endif INTOFF; dest->buf = ckrealloc(dest->buf, bufsize); dest->bufsize = bufsize; @@ -184,7 +188,9 @@ alloc: goto buffered; if ((xwrite(dest->fd, p, len))) { +#ifdef notyet err: +#endif dest->flags |= OUTPUT_ERR; } #endif