summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Mason <clm@fb.com>2024-04-10 08:30:26 -0700
committerChris Mason <clm@fb.com>2024-04-10 08:31:15 -0700
commite8ddaae2240898033cd7e877e3b6c610e30e6a4c (patch)
tree3c9035c13a1e0898293b3b0c7453f9dfee21e61e
parent13bd9cb0246d1c363a82ed91fcd4261652267a55 (diff)
downloadsimoop-e8ddaae2240898033cd7e877e3b6c610e30e6a4c.tar.gz
Fix compile warnings for strncpy
Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--simoop.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/simoop.c b/simoop.c
index cda681f..81204b9 100644
--- a/simoop.c
+++ b/simoop.c
@@ -295,7 +295,7 @@ static void crc_block(void *xxhash_state, char *block, uint64_t offset,
verify_header->offset = offset;
verify_header->rand_seed = rand_seed;
verify_header->inode = ino;
- strncpy(verify_header->magic, VERIFY_MAGIC, VERIFY_MAGIC_LEN);
+ memcpy(verify_header->magic, VERIFY_MAGIC, VERIFY_MAGIC_LEN);
verify_header->crc = __calc_crc(xxhash_state, verify_header);
}
@@ -354,7 +354,7 @@ static void check_block_headers(void *xxhash_state, char *filename,
failed++;
}
- if (strncmp(verify_header->magic, VERIFY_MAGIC, VERIFY_MAGIC_LEN)) {
+ if (memcmp(verify_header->magic, VERIFY_MAGIC, VERIFY_MAGIC_LEN)) {
fprintf(stderr, "bad magic file %s offset %lu\n", filename, offset);
fprintf(stderr, "found: ");
for (i = 0; i < VERIFY_MAGIC_LEN; i++) {
@@ -605,7 +605,7 @@ static void parse_options(int ac, char **av)
case 'n':
num_files = atoi(optarg);
num_files = ((num_files + FILES_SPLIT - 1)/ FILES_SPLIT) * FILES_SPLIT;
- fprintf(stderr, "Creating %d files\n", num_files);
+ fprintf(stderr, "Creating %ld files\n", num_files);
break;
case 'R':
read_size = parse_size(optarg);
@@ -1928,6 +1928,10 @@ static void sleep_for_runtime(struct thread_data *worker_threads_mem)
read_vmstat(&vmstat_info);
save_vmstat_rates(&vmstat_info);
save_instant_vmstat_rates(&vmstat_info);
+
+ if (interval_seconds > runtime)
+ interval_seconds = runtime;
+
while(!stopping) {
gettimeofday(&now, NULL);
instant_start = now;