~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to lib/fstatat.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Work around an fstatat bug on Solaris 9.
2
2
 
3
 
   Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
 
3
   Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc.
4
4
 
5
5
   This program is free software: you can redistribute it and/or modify
6
6
   it under the terms of the GNU General Public License as published by
29
29
#undef __need_system_sys_stat_h
30
30
 
31
31
#if HAVE_FSTATAT
32
 
static inline int
 
32
static int
33
33
orig_fstatat (int fd, char const *filename, struct stat *buf, int flags)
34
34
{
35
35
  return fstatat (fd, filename, buf, flags);
45
45
#include <fcntl.h>
46
46
#include <string.h>
47
47
 
48
 
#if HAVE_FSTATAT && !FSTATAT_ZERO_FLAG_BROKEN
 
48
#if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG
49
49
 
50
50
# ifndef LSTAT_FOLLOWS_SLASHED_SYMLINK
51
51
#  define LSTAT_FOLLOWS_SLASHED_SYMLINK 0
90
90
  return result;
91
91
}
92
92
 
93
 
#else /* !HAVE_FSTATAT || FSTATAT_ZERO_FLAG_BROKEN */
 
93
#else /* ! (HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG) */
94
94
 
95
 
/* On mingw, the gnulib <sys/stat.h> defines `stat' as a function-like
 
95
/* On mingw, the gnulib <sys/stat.h> defines 'stat' as a function-like
96
96
   macro; but using it in AT_FUNC_F2 causes compilation failure
97
97
   because the preprocessor sees a use of a macro that requires two
98
98
   arguments but is only given one.  Hence, we need an inline
99
99
   forwarder to get past the preprocessor.  */
100
 
static inline int
 
100
static int
101
101
stat_func (char const *name, struct stat *st)
102
102
{
103
103
  return stat (name, st);
104
104
}
105
105
 
106
 
/* Likewise, if there is no native `lstat', then the gnulib
 
106
/* Likewise, if there is no native 'lstat', then the gnulib
107
107
   <sys/stat.h> defined it as stat, which also needs adjustment.  */
108
108
# if !HAVE_LSTAT
109
109
#  undef lstat
118
118
   then give a diagnostic and exit nonzero.
119
119
   Otherwise, this function works just like Solaris' fstatat.  */
120
120
 
121
 
# if FSTATAT_ZERO_FLAG_BROKEN
122
 
#  define AT_FUNC_NAME rpl_fstatat
123
 
# else
124
 
#  define AT_FUNC_NAME fstatat
125
 
# endif
 
121
# define AT_FUNC_NAME fstatat
126
122
# define AT_FUNC_F1 lstat
127
123
# define AT_FUNC_F2 stat_func
128
124
# define AT_FUNC_USE_F1_COND AT_SYMLINK_NOFOLLOW