From 443db178899d14a9c54248d95675fee44d718e05 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 8 Mar 2008 01:57:18 +0000 Subject: [PATCH] [BZ #5778] * sysdeps/unix/sysv/linux/pathconf.h: Declare __statfs_chown_restricted. * sysdeps/unix/sysv/linux/fpathconf.c: Call __statfs_chown_restricted for _PC_CHOWN_RESTRICTED. * sysdeps/unix/sysv/linux/pathconf.c: Likewise. Implement __statfs_chown_restricted. * sysdeps/unix/sysv/linux/bits/posix_opt.h: Change _POSIX_CHOWN_RESTRICTED value to zero. 2008-02-26 Harsha Jagasia --- ChangeLog | 12 ++++++- localedata/ChangeLog | 5 +++ localedata/locales/es_CR | 4 +-- nptl/ChangeLog | 6 ++++ nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h | 6 ++-- sysdeps/unix/sysv/linux/bits/posix_opt.h | 7 ++-- sysdeps/unix/sysv/linux/fpathconf.c | 5 ++- sysdeps/unix/sysv/linux/pathconf.c | 48 ++++++++++++++++++++++++++- sysdeps/unix/sysv/linux/pathconf.h | 13 +++++--- 9 files changed, 91 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0a42047..9d9cf3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,18 @@ 2008-03-07 Ulrich Drepper + [BZ #5778] + * sysdeps/unix/sysv/linux/pathconf.h: Declare + __statfs_chown_restricted. + * sysdeps/unix/sysv/linux/fpathconf.c: Call __statfs_chown_restricted + for _PC_CHOWN_RESTRICTED. + * sysdeps/unix/sysv/linux/pathconf.c: Likewise. + Implement __statfs_chown_restricted. + * sysdeps/unix/sysv/linux/bits/posix_opt.h: Change + _POSIX_CHOWN_RESTRICTED value to zero. + * sysdeps/x86_64/rtld-memset.c: New file. -2008-2-26 Harsha Jagasia +2008-02-26 Harsha Jagasia * sysdeps/x86_64/cacheinfo.c (NOT_USED_RIGHT_NOW): Remove ifdef guards. diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 8da017d..e435623 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,8 @@ +2008-03-07 Ulrich Drepper + + [BZ #5777] + * locales/es_CR: Define am/pm format. + 2008-03-04 Ulrich Drepper * SUPPORTED (SUPPORTED-LOCALES): Add shs_CA.UTF-8. diff --git a/localedata/locales/es_CR b/localedata/locales/es_CR index aa335a2..753b22b 100644 --- a/localedata/locales/es_CR +++ b/localedata/locales/es_CR @@ -108,8 +108,8 @@ mon "";/ d_t_fmt "" d_fmt "" t_fmt "" -am_pm "";"" -t_fmt_ampm "" +am_pm "";"" +t_fmt_ampm "" date_fmt "/ / " diff --git a/nptl/ChangeLog b/nptl/ChangeLog index e22f387..c2a1354 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,9 @@ +2008-03-07 Ulrich Drepper + + [BZ #5778] + * sysdeps/unix/sysv/linux/bits/posix_opt.h: Change + _POSIX_CHOWN_RESTRICTED value to zero. + 2008-01-31 Roland McGrath * Makefile (omit-deps): Variable removed. diff --git a/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h b/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h index dd0798a..06d35ce 100644 --- a/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h +++ b/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h @@ -1,5 +1,5 @@ /* Define POSIX options for Linux. - Copyright (C) 1996-2004, 2006 Free Software Foundation, Inc. + Copyright (C) 1996-2004, 2006, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -47,8 +47,8 @@ /* Setting of memory protections is supported. */ #define _POSIX_MEMORY_PROTECTION 200112L -/* Only root can change owner of file. */ -#define _POSIX_CHOWN_RESTRICTED 1 +/* Some filesystems allow all users to change file ownership. */ +#define _POSIX_CHOWN_RESTRICTED 0 /* `c_cc' member of 'struct termios' structure can be disabled by using the value _POSIX_VDISABLE. */ diff --git a/sysdeps/unix/sysv/linux/bits/posix_opt.h b/sysdeps/unix/sysv/linux/bits/posix_opt.h index 1a96db2..37612e0 100644 --- a/sysdeps/unix/sysv/linux/bits/posix_opt.h +++ b/sysdeps/unix/sysv/linux/bits/posix_opt.h @@ -1,5 +1,6 @@ /* Define POSIX options for Linux. - Copyright (C) 1996,1997,1999,2000,2002,2003 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1999,2000,2002,2003,2008 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -51,8 +52,8 @@ /* Setting of memory protections is supported. */ #define _POSIX_MEMORY_PROTECTION 200112L -/* Only root can change owner of file. */ -#define _POSIX_CHOWN_RESTRICTED 1 +/* Some filesystems allow all users to change file ownership. */ +#define _POSIX_CHOWN_RESTRICTED 0 /* `c_cc' member of 'struct termios' structure can be disabled by using the value _POSIX_VDISABLE. */ diff --git a/sysdeps/unix/sysv/linux/fpathconf.c b/sysdeps/unix/sysv/linux/fpathconf.c index c1cdb1b..2701c9e 100644 --- a/sysdeps/unix/sysv/linux/fpathconf.c +++ b/sysdeps/unix/sysv/linux/fpathconf.c @@ -1,5 +1,5 @@ /* Get file-specific information about descriptor FD. Linux version. - Copyright (C) 1991,1995,1996,1998-2002,2003 Free Software Foundation, Inc. + Copyright (C) 1991,1995,1996,1998-2003,2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -45,6 +45,9 @@ __fpathconf (fd, name) case _PC_2_SYMLINKS: return __statfs_symlinks (__fstatfs (fd, &fsbuf), &fsbuf); + case _PC_CHOWN_RESTRICTED: + return __statfs_chown_restricted (__fstatfs (fd, &fsbuf), &fsbuf); + default: return posix_fpathconf (fd, name); } diff --git a/sysdeps/unix/sysv/linux/pathconf.c b/sysdeps/unix/sysv/linux/pathconf.c index e12a084..db03529 100644 --- a/sysdeps/unix/sysv/linux/pathconf.c +++ b/sysdeps/unix/sysv/linux/pathconf.c @@ -1,5 +1,5 @@ /* Get file-specific information about a file. Linux version. - Copyright (C) 1991,1995,1996,1998-2002,2003 Free Software Foundation, Inc. + Copyright (C) 1991,1995,1996,1998-2003,2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,8 +19,10 @@ #include #include + #include "pathconf.h" #include "linux_fsinfo.h" +#include static long int posix_pathconf (const char *file, int name); @@ -46,6 +48,9 @@ __pathconf (const char *file, int name) case _PC_2_SYMLINKS: return __statfs_symlinks (__statfs (file, &fsbuf), &fsbuf); + case _PC_CHOWN_RESTRICTED: + return __statfs_chown_restricted (__statfs (file, &fsbuf), &fsbuf); + default: return posix_pathconf (file, name); } @@ -179,3 +184,44 @@ __statfs_symlinks (int result, const struct statfs *fsbuf) return 1; } } + + +/* Used like: return __statfs_chown_restricted (__statfs (name, &buf), &buf);*/ +long int +__statfs_chown_restricted (int result, const struct statfs *fsbuf) +{ + if (result < 0) + { + if (errno == ENOSYS) + /* Not possible, return the default value. */ + return 1; + + /* Some error occured. */ + return -1; + } + + int fd; + long int retval = 1; + switch (fsbuf->f_type) + { + case XFS_SUPER_MAGIC: + /* Read the value from /proc/sys/fs/xfs/restrict_chown. If we cannot + read it default to assume the restriction is in place. */ + fd = open_not_cancel_2 ("/proc/sys/fs/xfs/restrict_chown", O_RDONLY); + if (fd != -1) + { + char buf[2]; + if (TEMP_FAILURE_RETRY (read_not_cancel (fd, buf, 2)) == 2 + && buf[0] >= '0' && buf[0] <= '1') + retval = buf[0] - '0'; + + close_not_cancel_no_status (fd); + } + break; + + default: + break; + } + + return retval; +} diff --git a/sysdeps/unix/sysv/linux/pathconf.h b/sysdeps/unix/sysv/linux/pathconf.h index 20e2368..806adcc 100644 --- a/sysdeps/unix/sysv/linux/pathconf.h +++ b/sysdeps/unix/sysv/linux/pathconf.h @@ -1,5 +1,5 @@ /* Common parts of Linux implementation of pathconf and fpathconf. - Copyright (C) 1991,1995,1996,1998-2002,2003 Free Software Foundation, Inc. + Copyright (C) 1991,1995,1996,1998-2003,2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,13 +22,18 @@ #include -/* Used like: return statfs_link_max (__statfs (name, &buf), &buf); */ +/* Used like: return __statfs_link_max (__statfs (name, &buf), &buf); */ extern long int __statfs_link_max (int result, const struct statfs *fsbuf); -/* Used like: return statfs_filesize_max (__statfs (name, &buf), &buf); */ +/* Used like: return __statfs_filesize_max (__statfs (name, &buf), &buf); */ extern long int __statfs_filesize_max (int result, const struct statfs *fsbuf); -/* Used like: return statfs_link_max (__statfs (name, &buf), &buf); */ +/* Used like: return __statfs_link_max (__statfs (name, &buf), &buf); */ extern long int __statfs_symlinks (int result, const struct statfs *fsbuf); + + +/* Used like: return __statfs_chown_restricted (__statfs (name, &buf), &buf);*/ +extern long int __statfs_chown_restricted (int result, + const struct statfs *fsbuf); -- 2.7.4