~ubuntu-branches/ubuntu/vivid/parted/vivid

« back to all changes in this revision

Viewing changes to lib/lstat.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-07-21 10:23:16 UTC
  • mfrom: (7.2.32 sid)
  • Revision ID: package-import@ubuntu.com-20140721102316-jsyv3yzmbo8vlde5
Tags: 3.1-3
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Work around a bug of lstat on some systems
2
2
 
3
 
   Copyright (C) 1997-2006, 2008-2010 Free Software Foundation, Inc.
 
3
   Copyright (C) 1997-2006, 2008-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
17
17
 
18
18
/* written by Jim Meyering */
19
19
 
 
20
/* If the user's config.h happens to include <sys/stat.h>, let it include only
 
21
   the system's <sys/stat.h> here, so that orig_lstat doesn't recurse to
 
22
   rpl_lstat.  */
 
23
#define __need_system_sys_stat_h
20
24
#include <config.h>
21
25
 
22
26
#if !HAVE_LSTAT
27
31
#else /* HAVE_LSTAT */
28
32
 
29
33
/* Get the original definition of lstat.  It might be defined as a macro.  */
30
 
# define __need_system_sys_stat_h
31
34
# include <sys/types.h>
32
35
# include <sys/stat.h>
33
36
# undef __need_system_sys_stat_h
39
42
}
40
43
 
41
44
/* Specification.  */
42
 
# include <sys/stat.h>
 
45
/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
 
46
   eliminates this include because of the preliminary #include <sys/stat.h>
 
47
   above.  */
 
48
# include "sys/stat.h"
43
49
 
44
50
# include <string.h>
45
51
# include <errno.h>
46
52
 
47
53
/* lstat works differently on Linux and Solaris systems.  POSIX (see
48
 
   `pathname resolution' in the glossary) requires that programs like
49
 
   `ls' take into consideration the fact that FILE has a trailing slash
 
54
   "pathname resolution" in the glossary) requires that programs like
 
55
   'ls' take into consideration the fact that FILE has a trailing slash
50
56
   when FILE is a symbolic link.  On Linux and Solaris 10 systems, the
51
57
   lstat function already has the desired semantics (in treating
52
 
   `lstat ("symlink/", sbuf)' just like `lstat ("symlink/.", sbuf)',
 
58
   'lstat ("symlink/", sbuf)' just like 'lstat ("symlink/.", sbuf)',
53
59
   but on Solaris 9 and earlier it does not.
54
60
 
55
61
   If FILE has a trailing slash and specifies a symbolic link,