Bug Summary

File:obj-scan-build/libtrivfs/../../libtrivfs/times.c
Location:line 31, column 3
Description:Passed-by-value struct argument contains uninitialized data (e.g., field: 'seconds')

Annotated Source Code

1/*
2 Copyright (C) 1994, 1999, 2007 Free Software Foundation
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2, or (at
7 your option) any later version.
8
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17
18#include "priv.h"
19
20error_t
21trivfs_set_atime (struct trivfs_control *cntl)
22{
23 struct stat st;
24 time_value_t atime;
25 time_value_t mtime;
26
27 io_stat (cntl->underlying, &st);
28 mtime.seconds = st.st_mtim.tv_sec;
29 mtime.microseconds = st.st_mtim.tv_nsec / 1000;
30 atime.microseconds = -1;
31 file_utimes (cntl->underlying, atime, mtime);
Passed-by-value struct argument contains uninitialized data (e.g., field: 'seconds')
32 return 0;
33}
34
35error_t
36trivfs_set_mtime (struct trivfs_control *cntl)
37{
38 struct stat st;
39 time_value_t atime;
40 time_value_t mtime;
41
42 io_stat (cntl->underlying, &st);
43 atime.seconds = st.st_atim.tv_sec;
44 atime.microseconds = st.st_atim.tv_nsec / 1000;
45 mtime.microseconds = -1;
46 file_utimes (cntl->underlying, atime, mtime);
47 return 0;
48}