From: Andre Noll <maan@tuebingen.mpg.de>
Date: Sun, 7 Feb 2016 16:33:15 +0000 (+0100)
Subject: attribute: Avoid shifting 32 bit integers.
X-Git-Tag: v0.5.6~59^2
X-Git-Url: https://git.tue.mpg.de/?a=commitdiff_plain;h=7505e8b0458eed519ee5121bf9a8007fb72eb17a;p=paraslash.git

attribute: Avoid shifting 32 bit integers.

Doing "1UL << i" is wrong here, because the constant "1UL" is 32 bit
on 32 bit systems and we definitely need 64 bit quantities for the
attribute mask.

Fix this by using an uint64_t variable instead.
---

diff --git a/attribute.c b/attribute.c
index 5672309a..65f08aef 100644
--- a/attribute.c
+++ b/attribute.c
@@ -222,7 +222,7 @@ int com_lsatt(struct command_context *cc)
 static void com_setatt_callback(__a_unused int fd, const struct osl_object *query)
 {
 	char *p;
-	uint64_t add_mask = 0, del_mask = 0;
+	uint64_t add_mask = 0, del_mask = 0, one = 1;
 	int ret;
 	size_t len;
 	struct osl_object obj;
@@ -249,9 +249,9 @@ static void com_setatt_callback(__a_unused int fd, const struct osl_object *quer
 		if (ret < 0)
 			goto out;
 		if (c == '+')
-			add_mask |= (1UL << *(unsigned char *)obj.data);
+			add_mask |= (one << *(unsigned char *)obj.data);
 		else
-			del_mask |= (1UL << *(unsigned char *)obj.data);
+			del_mask |= (one << *(unsigned char *)obj.data);
 	}
 	ret = -E_ATTR_SYNTAX;
 	if (!add_mask && !del_mask)