From 82dea3043878099e392b71bef9ae5de616ac5533 Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Mon, 26 Oct 2009 05:34:21 +0000 Subject: storage/posix: Ensure time(2) is stored in a 64-bit variable. Before multiplying the time_t value by 2^32, store it in a 64-bit variable. This is necessary on 32-bit systems, where time_t is only 32-bits, and left-shifting by 32 results in 0. Signed-off-by: Anand V. Avati BUG: 315 (generation number support) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=315 --- xlators/storage/posix/src/posix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'xlators/storage/posix') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 7c15f92711a..82462db955d 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -4676,6 +4676,7 @@ init (xlator_t *this) struct posix_private * _private = NULL; data_t * dir_data = NULL; data_t * tmp_data = NULL; + uint64_t time64 = 0; dir_data = dict_get (this->options, "directory"); @@ -4847,7 +4848,8 @@ init (xlator_t *this) _private->st_device[0] = buf.st_dev; LOCK_INIT (&_private->gen_lock); - _private->gen_seq = (time (NULL) << 32); + time64 = time (NULL); + _private->gen_seq = (time64 << 32); #ifndef GF_DARWIN_HOST_OS { -- cgit