diff options
author | NeilBrown <neilb@suse.de> | 2013-07-02 08:08:34 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-07-02 08:08:34 +0200 |
commit | 4bffc964b9e4c91877d1a863b06cab4748732b15 (patch) | |
tree | c8315470344d0d76769ac37be27b1b6009dda3f7 /sysfs.c | |
parent | raid6check - fix compile (diff) | |
download | mdadm-4bffc964b9e4c91877d1a863b06cab4748732b15.tar.xz mdadm-4bffc964b9e4c91877d1a863b06cab4748732b15.zip |
sysfs: fix bugs in new sysfs_wait function.
- 'tv' isn't initialised properly.
- 100? I'm sure I fixed that already! Seems not.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'sysfs.c')
-rw-r--r-- | sysfs.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -904,15 +904,18 @@ int sysfs_wait(int fd, int *msec) else { struct timeval start, end, tv; gettimeofday(&start, NULL); - if (*msec < 1000) + if (*msec < 1000) { + tv.tv_sec = 0; tv.tv_usec = (*msec)*1000; - else + } else { tv.tv_sec = (*msec)/1000; + tv.tv_usec = 0; + } n = select(fd+1, NULL, NULL, &fds, &tv); gettimeofday(&end, NULL); end.tv_sec -= start.tv_sec; *msec -= (end.tv_sec * 1000 + end.tv_usec/1000 - - start.tv_usec/100) + 1; + - start.tv_usec/1000) + 1; } return n; } |