public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@gnu.org>
To: kerolasa@gmail.com
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH 09/17] lib: add fileutils function collection
Date: Fri, 09 Mar 2012 12:48:55 +0100	[thread overview]
Message-ID: <1331293735.4092.3.camel@offworld> (raw)
In-Reply-To: <CAG27Bk2LYb6h8djj0yom17oKtAy6Vvfh85Fu2k8+M9kPQGhPZg@mail.gmail.com>

On Fri, 2012-03-09 at 08:56 +0100, Sami Kerola wrote:
> On Mon, Mar 5, 2012 at 22:51, Davidlohr Bueso <dave@gnu.org> wrote:
> > On Mon, 2012-03-05 at 20:38 +0100, Sami Kerola wrote:
> >>  create mode 100644 include/fileutils.h
> >>  create mode 100644 lib/fileutils.c
> >
> > Doesn't really make much sense creating two files for just one
> > function.  Couldn't xmkstemp() so somewhere else?  You might argue
> > that xgetpass also does that, I just think it's an overkill...
> 
> Hi Davidlohr,
> 
> You are right, at least partially.  The reason why I added the files
> is simply that non of the existing files felt correct to add this
> function.  IMHO xgetpass.c would be more strange file to have
> xmkstemp() than fileutils.c to contain xgetpass().

I'm just saying that xgetpass also just contains one function and that
it's an overkill, no big deal in any case.

> 
> >> +/* Create open temporary file in safe way.  Please notice that the
> >> + * file permissions are -rw------- by default. */
> >> +FILE *xmkstemp(char **tmpname)
> >
> > Returning the file descriptor seems a more flexible interface
> > instead of the FILE's representation; the user can always use
> > fdopen on his own.
> 
> If I need temporary file I rather have stream than file descriptor.
> Could you give example why flexibility is better than completeness.
> With completeness I mean service that the function provides.  If
> after every single occurrence of xmkstemp() there would be fdopen() I
> would argue adding flexibility did not do anything good.

I don't see how streams are more complete than descriptors - and no,
every call to mkstemp *does not* require a call to fdopen, that's
completely up to the user's use case.

Cheers,
Davidlohr


  reply	other threads:[~2012-03-09 11:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-04 13:35 [pull] fixes to todo items etc Sami Kerola
2012-03-05 12:38 ` Karel Zak
2012-03-05 19:38   ` Sami Kerola
2012-03-05 19:38     ` [PATCH 01/17] docs: add deprecation comments Sami Kerola
2012-03-05 19:38     ` [PATCH 02/17] docs: TODO removal, login-utils error printing Sami Kerola
2012-03-05 19:38     ` [PATCH 03/17] sfdisk: use rpmatch to yes/no question Sami Kerola
2012-03-05 19:38     ` [PATCH 04/17] mesg: " Sami Kerola
2012-03-05 19:38     ` [PATCH 05/17] vipw: " Sami Kerola
2012-03-05 19:38     ` [PATCH 06/17] docs: TODO removal, rpmatch task is done Sami Kerola
2012-03-05 19:38     ` [PATCH 07/17] chfn: use pathnames.h for paths Sami Kerola
2012-03-05 19:38     ` [PATCH 08/17] chsh: " Sami Kerola
2012-03-05 19:38     ` [PATCH 09/17] lib: add fileutils function collection Sami Kerola
     [not found]       ` <"1 330984305.2953.25.camel"@offbook>
     [not found]       ` <"1330984305.2953.25.camel"@offbook>
2012-03-05 21:51       ` Davidlohr Bueso
2012-03-09  7:56         ` Sami Kerola
2012-03-09 11:48           ` Davidlohr Bueso [this message]
2012-03-09 12:20             ` Karel Zak
2012-03-10 11:49               ` Sami Kerola
2012-03-05 19:38     ` [PATCH 10/17] wall: use xmkstemp for temporary file Sami Kerola
2012-03-05 19:38     ` [PATCH 11/17] setpwnam: use xmkstemp() and lckpwdf() Sami Kerola
2012-03-05 19:38     ` [PATCH 12/17] vipw: " Sami Kerola
2012-03-05 19:38     ` [PATCH 13/17] pathnames: clean up various user database paths Sami Kerola
2012-03-05 20:44       ` Sami Kerola
2012-03-05 19:38     ` [PATCH 14/17] docs: TODO removal, ldattach usage is done Sami Kerola
2012-03-05 19:38     ` [PATCH 15/17] include: add asprintf wrapper Sami Kerola
2012-03-05 19:52       ` Dave Reisner
2012-03-05 20:47         ` Sami Kerola
2012-03-05 19:38     ` [PATCH 16/17] xalloc: use xasprintf in all files Sami Kerola
2012-03-05 19:38     ` [PATCH 17/17] build-sys: fix chkdupexe regression Sami Kerola
2012-03-20  8:07 ` [pull] fixes to todo items etc Karel Zak

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=1331293735.4092.3.camel@offworld \
    --to=dave@gnu.org \
    --cc=kerolasa@gmail.com \
    --cc=util-linux@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox