diff options
author | Jim Meyering <jim@meyering.net> | 1998-07-03 23:56:44 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-07-03 23:56:44 +0000 |
commit | 345c323ffd475f549fee3ec2ca86a2c4b4e3bd7e (patch) | |
tree | 489d27219eb4268c01832ff62cb48198599d9258 | |
parent | 1f682431aed8769caee308aa0334e303ab1f1c82 (diff) | |
download | coreutils-345c323ffd475f549fee3ec2ca86a2c4b4e3bd7e.tar.xz |
(copy_internal): Rename variable and reverse sense of tests
to make the code a little clearer.
-rw-r--r-- | src/copy.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/copy.c b/src/copy.c index e161a3950..6553d6530 100644 --- a/src/copy.c +++ b/src/copy.c @@ -671,19 +671,22 @@ copy_internal (const char *src_path, const char *dst_path, struct stat dot_sb; struct stat dst_parent_sb; char *dst_parent; - int not_current_dir; + int in_current_dir; dst_parent = dirname (dst_path); if (dst_parent == NULL) error (1, 0, _("virtual memory exhausted")); - not_current_dir = (!STREQ (".", dst_parent) - && stat (".", &dot_sb) == 0 - && stat (dst_parent, &dst_parent_sb) == 0 - && !SAME_INODE (dot_sb, dst_parent_sb)); + in_current_dir = (STREQ (".", dst_parent) + /* If either stat call fails, it's ok not to report + the failure and say dst_path is in the current + directory. Other things will fail later. */ + || stat (".", &dot_sb) + || stat (dst_parent, &dst_parent_sb) + || SAME_INODE (dot_sb, dst_parent_sb)); free (dst_parent); - if (not_current_dir) + if (! in_current_dir) { error (0, 0, _("%s: can make relative symbolic links only in current directory"), |