diff options
author | Vikas Gorur <vikas@gluster.com> | 2009-10-26 05:34:21 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-26 07:09:24 -0700 |
commit | 82dea3043878099e392b71bef9ae5de616ac5533 (patch) | |
tree | 4ea2e6e32322bdf2a48a8ca869e0dc7970fe1af8 | |
parent | bd145077164ee20e3eb03f09b401e9a3ebdf8b6e (diff) |
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 <avati@dev.gluster.com>
BUG: 315 (generation number support)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=315
-rw-r--r-- | xlators/storage/posix/src/posix.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 { |