mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-18 00:58:31 +00:00
test/bers: use size_t format specifiers for file counters
shared->opt_files and loop index i are size_t values. Printing them with "%lu"/"%d" is type-mismatched and can produce incorrect output on some platforms. Switch these sites to "%zu" in logging and path formatting. Signed-off-by: Farzan Aman Khan <farzanaman99@gmail.com>
This commit is contained in:
parent
3d5eb1c14c
commit
d24bfbf7df
1 changed files with 2 additions and 2 deletions
|
|
@ -135,14 +135,14 @@ static int create_files(shared_data_t *shared, int *fd, size_t nr_files)
|
|||
|
||||
memset(fd, 0xff, sizeof(*fd) * MAX_CHUNK);
|
||||
|
||||
pr_info("\tCreating %lu files\n", shared->opt_files);
|
||||
pr_info("\tCreating %zu files\n", shared->opt_files);
|
||||
|
||||
for (i = 0; i < shared->opt_files; i++) {
|
||||
if (shared->prev_fd[i] != -1) {
|
||||
close(shared->prev_fd[i]);
|
||||
shared->prev_fd[i] = -1;
|
||||
}
|
||||
snprintf(path, sizeof(path), "%08d-%04d-temp", sys_gettid(), i);
|
||||
snprintf(path, sizeof(path), "%08d-%04zu-temp", sys_gettid(), i);
|
||||
fd[i] = openat(shared->work_dir_fd, path, O_RDWR | O_CREAT | O_TRUNC, 0666);
|
||||
if (fd[i] < 0) {
|
||||
pr_perror("Can't open %s/%s", shared->opt_work_dir, path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue