From a037e838e15c9a698f1634398e0fe2726398d575 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Wed, 23 Sep 2009 10:10:51 +0100 Subject: maint: Use logical rather than bitwise operators on bools This is because bitwise operators are: - confusing and inconsistent in a boolean context - non short circuiting - brittle in C89 where bool can be an int (so > 1) --- src/cp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cp.c') diff --git a/src/cp.c b/src/cp.c index 4b5934eb5..f3fc1aae7 100644 --- a/src/cp.c +++ b/src/cp.c @@ -1089,7 +1089,7 @@ main (int argc, char **argv) } } - if (x.hard_link & x.symbolic_link) + if (x.hard_link && x.symbolic_link) { error (0, 0, _("cannot make both hard and symbolic links")); usage (EXIT_FAILURE); @@ -1130,7 +1130,7 @@ main (int argc, char **argv) /* If --force (-f) was specified and we're in link-creation mode, first remove any existing destination file. */ - if (x.unlink_dest_after_failed_open & (x.hard_link | x.symbolic_link)) + if (x.unlink_dest_after_failed_open && (x.hard_link || x.symbolic_link)) x.unlink_dest_before_opening = true; if (x.preserve_security_context) -- cgit v1.2.3-54-g00ecf