File: libfakeroot_inode64.c

package info (click to toggle)
fakeroot 1.14.4-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,000 kB
  • ctags: 565
  • sloc: sh: 10,485; ansic: 3,538; makefile: 290; perl: 14
file content (133 lines) | stat: -rw-r--r-- 3,000 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
  Copyright Ⓒ 2009  Regis Duchesne

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

*/

#ifdef __APPLE__
/*
   This file is for symbols which have the "$INODE64" version, i.e. symbols
   which use a 64-bit ino_t.

   In this file, 'struct stat' is an alias for 'struct stat64'.
*/
#define _DARWIN_USE_64_BIT_INODE

#include "config.h"
#include "communicate.h"

#include <stdio.h>
#ifdef HAVE_SYS_ACL_H
#include <sys/acl.h>
#endif /* HAVE_SYS_ACL_H */
#if HAVE_FTS_H
#include <fts.h>
#endif /* HAVE_FTS_H */

#include "wrapped.h"

#ifdef LIBFAKEROOT_DEBUGGING
extern int fakeroot_debug;

#endif /* LIBFAKEROOT_DEBUGGING */
int lstat(const char *file_name,
          struct stat *st){

  int r;

#ifdef LIBFAKEROOT_DEBUGGING
  if (fakeroot_debug) {
    fprintf(stderr, "lstat$INODE64 file_name %s\n", file_name);
  }
#endif /* LIBFAKEROOT_DEBUGGING */
  r=next_lstat$INODE64(file_name, st);

  if(r)
    return -1;

  send_get_stat64((struct stat64 *)st);
  return 0;
}


int stat(const char *file_name,
         struct stat *st){
  int r;

#ifdef LIBFAKEROOT_DEBUGGING
  if (fakeroot_debug) {
    fprintf(stderr, "stat$INODE64 file_name %s\n", file_name);
  }
#endif /* LIBFAKEROOT_DEBUGGING */
  r=next_stat$INODE64(file_name,st);
  if(r)
    return -1;
  send_get_stat64((struct stat64 *)st);
  return 0;
}


int fstat(int fd,
          struct stat *st){
  int r;

#ifdef LIBFAKEROOT_DEBUGGING
  if (fakeroot_debug) {
    fprintf(stderr, "fstat$INODE64 fd %d\n", fd);
  }
#endif /* LIBFAKEROOT_DEBUGGING */
  r=next_fstat$INODE64(fd, st);
  if(r)
    return -1;
  send_get_stat64((struct stat64 *)st);

  return 0;
}

#ifdef HAVE_FTS_READ
FTSENT *fts_read(FTS *ftsp) {
  FTSENT *r;

#ifdef LIBFAKEROOT_DEBUGGING
  if (fakeroot_debug) {
    fprintf(stderr, "fts_read$INODE64\n");
  }
#endif /* LIBFAKEROOT_DEBUGGING */
  r=next_fts_read$INODE64(ftsp);
  if(r && r->fts_statp) {  /* Should we bother checking fts_info here? */
    send_get_stat64((struct stat64 *)r->fts_statp);
  }

  return r;
}

FTSENT *fts_children(FTS *ftsp,
                     int options) {
  FTSENT *first;
  FTSENT *r;

#ifdef LIBFAKEROOT_DEBUGGING
  if (fakeroot_debug) {
    fprintf(stderr, "fts_children$INODE64\n");
  }
#endif /* LIBFAKEROOT_DEBUGGING */
  first=next_fts_children$INODE64(ftsp, options);
  for(r = first; r; r = r->fts_link) {
    if(r->fts_statp) {  /* Should we bother checking fts_info here? */
      send_get_stat64((struct stat64 *)r->fts_statp);
    }
  }

  return first;
}
#endif /* HAVE_FTS_READ */
#endif /* ifdef __APPLE__ */