[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH 4/5] daemon error handling: Define a new function reply_with_perror_errno.



On Mon, Nov 30, 2009 at 02:48:07PM +0000, Richard W.M. Jones wrote:
> For example, original code:
> 

These are of course the wrong way round.  The examples should be:

  r = some_system_call ();
  err = errno;
  do_cleanup ();
  errno = err;
  if (r == -1) {
    reply_with_perror ("failed");
    return -1;
  }

[can in future be changed to]

  r = some_system_call ();
  err = errno;
  do_cleanup ();
  if (r == -1) {
    reply_with_perror_errno (err, "failed");
    return -1;
  }

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]