All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Luiz Fernando Capitulino <lcapitulino@conectiva.com.br>
Cc: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] Re: [RESEND] - Fixes rfcomm program error codes.
Date: Fri, 17 Jun 2005 00:08:52 +0200	[thread overview]
Message-ID: <1118959732.8980.107.camel@pegasus> (raw)
In-Reply-To: <42B1E63F.204@conectiva.com.br>

Hi Luiz,

> > I don't see the advantages from changing "exit(1)" into "return -1".
> > This doesn't fix program error codes.
> 
>  Sure, but actually, the functions are returning -1, while main()
> checks this return value and does return 'exit(1)' on error. So, this
> patch fixes the error codes.
> 
>  I guess you're speaking about some changes from 'exit(1)' to 'return -1'
> I've made. I did that change, as I changed some 'return -errno' or added
> proper return value to void functions.
> 
>  I saw that most programs (but not all) in the utils package calls exit(1)
> directly in the functions when an error happens. IMHO, making functions
> return -1 (instead of aborting directly) is pretty better because: 1) system
> calls and libc follows that standard; 2) it's easier to copy and paste functions
> in other programs; and 3) your program has only one exit point (in main()).
> 
> But of course, maybe it's not an issue, and if you wants to, I can change it to
> exit in functions directly.

lets keep it using "exit(1)". It is an historic issue. Send a patch for
the few cases we did it wrong.

And btw I support people copying the code, but I also like to see that
people understand what the code does. If they have to change "exit(1)"
to have proper return values in their own code, they at least looked at
the code once.

Regards

Marcel




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2005-06-16 22:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-16 20:00 [RESEND] - Fixes rfcomm program error codes Luiz Fernando Capitulino
2005-06-16 21:24 ` [Bluez-devel] " Marcel Holtmann
2005-06-16 20:51   ` Luiz Fernando Capitulino
2005-06-16 22:08     ` Marcel Holtmann [this message]
2005-06-17 16:53       ` Luiz Fernando Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1118959732.8980.107.camel@pegasus \
    --to=marcel@holtmann.org \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=lcapitulino@conectiva.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.