[lxc-devel] [PATCH] replace redundant creat() with open()

S.Çağlar Onur caglar at 10ur.org
Tue Nov 12 16:52:36 UTC 2013


On Nov 8, 2013 5:20 PM, "Serge Hallyn" <serge.hallyn at ubuntu.com> wrote:
>
> Quoting S.Çağlar Onur (caglar at 10ur.org):
> > Hey Serge,
> >
> > On Fri, Nov 8, 2013 at 4:06 PM, Serge Hallyn <serge.hallyn at ubuntu.com>
wrote:
> > > Quoting S.Çağlar Onur (caglar at 10ur.org):
> > >> creat() is equivalent to open() with flags equal to
O_CREAT|O_WRONLY|O_TRUNC
> > >
> > > Hi,
> > >
> > > I'm confused - what is redundant in the use of creat()?  If there is
an
> > > improvement here then I don't understand what it is.  Otherwise I'd
> > > argue creat() is more concise and clearer about its intent.
> >
> > There is no improvement other than a syntactic change (assuming
> > creat() is also protected by glibc like open()). I saw them while
> > trying to come up with a list of functions protected by process_lock
> > and replaced them with open() without checking what glibc does. If you
> > think creat is also protected than please feel free to drop this :)
>
> int
> __libc_creat (file, mode)
>      const char *file;
>      mode_t mode;
> {
>   return __open (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
> }

Eheh see, redundant as well as missing a letter :P

> :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20131112/8695e75a/attachment.html>


More information about the lxc-devel mailing list