~ubuntu-branches/ubuntu/lucid/coreutils/lucid-updates

« back to all changes in this revision

Viewing changes to lib/root-dev-ino.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Stone
  • Date: 2009-04-07 19:21:42 UTC
  • mfrom: (1.2.1 upstream) (5.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090407192142-eez7bafqc4oqxox5
* new upstream version (Closes: #517558)
* [78] fix kfreebsd build problem (Closes: #520368)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Root device and inode number checking.
 
2
 
 
3
   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
 
4
 
 
5
   This program is free software: you can redistribute it and/or modify
 
6
   it under the terms of the GNU General Public License as published by
 
7
   the Free Software Foundation, either version 3 of the License, or
 
8
   (at your option) any later version.
 
9
 
 
10
   This program is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
   GNU General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU General Public License
 
16
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
17
 
 
18
#ifndef ROOT_DEV_INO_H
 
19
# define ROOT_DEV_INO_H 1
 
20
 
 
21
# include "dev-ino.h"
 
22
# include "same-inode.h"
 
23
 
 
24
struct dev_ino *
 
25
get_root_dev_ino (struct dev_ino *root_d_i);
 
26
 
 
27
/* These macros are common to the programs that support the
 
28
   --preserve-root and --no-preserve-root options.  */
 
29
 
 
30
# define ROOT_DEV_INO_CHECK(Root_dev_ino, Dir_statbuf) \
 
31
    (Root_dev_ino && SAME_INODE (*Dir_statbuf, *Root_dev_ino))
 
32
 
 
33
# define ROOT_DEV_INO_WARN(Dirname)                                     \
 
34
  do                                                                    \
 
35
    {                                                                   \
 
36
      if (STREQ (Dirname, "/"))                                         \
 
37
        error (0, 0, _("it is dangerous to operate recursively on %s"), \
 
38
               quote (Dirname));                                        \
 
39
      else                                                              \
 
40
        error (0, 0,                                                    \
 
41
               _("it is dangerous to operate recursively on %s (same as %s)"), \
 
42
               quote_n (0, Dirname), quote_n (1, "/"));                 \
 
43
      error (0, 0, _("use --no-preserve-root to override this failsafe")); \
 
44
    }                                                                   \
 
45
  while (0)
 
46
 
 
47
#endif