From: Jim Meyering Date: Sun, 26 Jan 1997 04:30:39 +0000 (+0000) Subject: (is_ancestor): Add it. X-Git-Tag: TEXTUTILS-1_21a~11 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=e1ea22da057e9faff943ffd6b03bab0c4c9c3bc2;p=thirdparty%2Fcoreutils.git (is_ancestor): Add it. --- diff --git a/src/cp.c b/src/cp.c index 93dce2c163..7e3489158b 100644 --- a/src/cp.c +++ b/src/cp.c @@ -211,6 +211,18 @@ static struct option const long_opts[] = {NULL, 0, NULL, 0} }; +static int +is_ancestor (const struct stat *sb, const struct dir_list *ancestors) +{ + while (ancestors != 0) + { + if (ancestors->ino == sb->st_ino && ancestors->dev == sb->st_dev) + return 1; + ancestors = ancestors->parent; + } + return 0; +} + int main (int argc, char **argv) { @@ -570,7 +582,7 @@ is not a directory"), usage (1); } } - + /* Copy the file SRC_PATH to the file DST_PATH. The files may be of any type. NEW_DST should be nonzero if the file DST_PATH cannot exist because its parent directory was just created; NEW_DST should