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

« back to all changes in this revision

Viewing changes to lib/stat.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 platform bugs in stat.
2
 
   Copyright (C) 2009-2011 Free Software Foundation, Inc.
 
2
   Copyright (C) 2009-2012 Free Software Foundation, Inc.
3
3
 
4
4
   This program is free software: you can redistribute it and/or modify
5
5
   it under the terms of the GNU General Public License as published by
27
27
#include <sys/stat.h>
28
28
#undef __need_system_sys_stat_h
29
29
 
 
30
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
31
# if _GL_WINDOWS_64_BIT_ST_SIZE
 
32
#  undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
 
33
#  define stat _stati64
 
34
#  define REPLACE_FUNC_STAT_DIR 1
 
35
#  undef REPLACE_FUNC_STAT_FILE
 
36
# elif REPLACE_FUNC_STAT_FILE
 
37
/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a.
 
38
   Bypass it.  */
 
39
#  define stat _stat
 
40
#  define REPLACE_FUNC_STAT_DIR 1
 
41
#  undef REPLACE_FUNC_STAT_FILE
 
42
# endif
 
43
#endif
 
44
 
30
45
static inline int
31
46
orig_stat (const char *filename, struct stat *buf)
32
47
{
46
61
#include "dosname.h"
47
62
#include "verify.h"
48
63
 
 
64
#if REPLACE_FUNC_STAT_DIR
 
65
# include "pathmax.h"
 
66
  /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also
 
67
     have a constant PATH_MAX.  */
 
68
# ifndef PATH_MAX
 
69
#  error "Please port this replacement to your platform"
 
70
# endif
 
71
#endif
 
72
 
49
73
/* Store information about NAME into ST.  Work around bugs with
50
74
   trailing slashes.  Mingw has other bugs (such as st_ino always
51
75
   being 0 on success) which this wrapper does not work around.  But
70
94
    }
71
95
#endif /* REPLACE_FUNC_STAT_FILE */
72
96
#if REPLACE_FUNC_STAT_DIR
73
 
  /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also
74
 
     have a constant PATH_MAX.  */
75
 
# ifndef PATH_MAX
76
 
#  error "Please port this replacement to your platform"
77
 
# endif
78
97
 
79
98
  if (result == -1 && errno == ENOENT)
80
99
    {