On Tue, 2011-09-06 at 06:40 -0700, Khem Raj wrote:
> On Tue, Sep 6, 2011 at 1:30 AM, Jonas Bonn <[email protected]> wrote:
> >
> > Signed-off-by: Jonas Bonn <[email protected]>
> > ---
> >  libc/sysdeps/linux/common/chmod.c |    9 +++++++++
> >  1 files changed, 9 insertions(+), 0 deletions(-)
> >
> > diff --git a/libc/sysdeps/linux/common/chmod.c 
> > b/libc/sysdeps/linux/common/chmod.c
> > index 871e023..c60456f 100644
> > --- a/libc/sysdeps/linux/common/chmod.c
> > +++ b/libc/sysdeps/linux/common/chmod.c
> > @@ -9,8 +9,16 @@
> >
> >  #include <sys/syscall.h>
> >  #include <sys/stat.h>
> > +#include <fcntl.h>
> > +#include <unistd.h>
> >
> 
> those includes could also be put in conditionals if they were not needed 
> before

That would give us

#include <unistd.h>
#ifdef __NR_fchmodat
#include <fcntl.h>
#endif

Given that __NR_fchmodat will be defined for any recent Linux kernel and
thus be usual case, this doesn't seem particularly elegant.

But it's doable if it's really necessary.

/Jonas

> 
> > +#ifdef __NR_fchmodat
> > +int chmod(const char *path, mode_t mode)
> > +{
> > +       return fchmodat(AT_FDCWD, path, mode, 0);
> > +}
> >
> > +#else
> >  #define __NR___syscall_chmod __NR_chmod
> >  static __inline__ _syscall2(int, __syscall_chmod, const char *, path, 
> > __kernel_mode_t, mode)
> >
> > @@ -18,4 +26,5 @@ int chmod(const char *path, mode_t mode)
> >  {
> >        return __syscall_chmod(path, mode);
> >  }
> > +#endif
> >  libc_hidden_def(chmod)
> > --
> > 1.7.5.4
> >
> > _______________________________________________
> > uClibc mailing list
> > [email protected]
> > http://lists.busybox.net/mailman/listinfo/uclibc
> >

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to