]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/i386/chown.c
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / i386 / chown.c
CommitLineData
d4697bc9 1/* Copyright (C) 1998-2014 Free Software Foundation, Inc.
19212f87
UD
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
19212f87
UD
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 12 Lesser General Public License for more details.
19212f87 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
19212f87
UD
17
18#include <errno.h>
19#include <unistd.h>
0dee6738
UD
20
21#include <sysdep.h>
19212f87 22#include <sys/syscall.h>
41aefe41 23#include <shlib-compat.h>
313fed01 24
4bbb61e4 25#include <linux/posix_types.h>
958f238f 26
19212f87
UD
27/*
28 In Linux 2.1.x the chown functions have been changed. A new function lchown
29 was introduced. The new chown now follows symlinks - the old chown and the
30 new lchown do not follow symlinks.
31 The new lchown function has the same number as the old chown had and the
32 new chown has a new number. When compiling with headers from Linux > 2.1.8x
33 it's impossible to run this libc with older kernels. In these cases libc
34 has therefore to route calls to chown to the old chown function.
35*/
36
dde52fca
AJ
37extern int __chown_is_lchown (const char *__file, uid_t __owner,
38 gid_t __group);
39extern int __real_chown (const char *__file, uid_t __owner, gid_t __group);
40
41
21708942 42/* Consider moving to syscalls.list. */
19212f87
UD
43
44int
45__real_chown (const char *file, uid_t owner, gid_t group)
46{
6277fdab 47 return INLINE_SYSCALL (chown32, 3, file, owner, group);
ffb7875d 48}
19212f87
UD
49
50
ffb7875d 51#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
382466e0 52/* Compiling for compatibility. */
19212f87 53int
4a381a81 54attribute_compat_text_section
19212f87
UD
55__chown_is_lchown (const char *file, uid_t owner, gid_t group)
56{
57 return __lchown (file, owner, group);
58}
59#endif
60
41aefe41 61#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
dd410d4d 62compat_symbol (libc, __chown_is_lchown, chown, GLIBC_2_0);
deb7f0b4 63#endif
19212f87 64
dd410d4d
RM
65versioned_symbol (libc, __real_chown, chown, GLIBC_2_1);
66strong_alias (__real_chown, __chown)
dd410d4d 67libc_hidden_def (__chown)