Skip to content

Commit 097438f

Browse files
committed
posix.cfg: utimes() is a wrapper for utime(), which is obsolescent. Set utimes() as obsolescent as well.
1 parent 478aa67 commit 097438f

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

cfg/posix.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
16951695
<not-bool/>
16961696
<minsize type="value" value="2"/>
16971697
</arg>
1698+
<warn severity="style" reason="Obsolescent" alternatives="utimensat"/>
16981699
</function>
16991700
<!-- DIR *opendir(const char *name); -->
17001701
<function name="opendir">

test/cfg/posix.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,15 @@ void invalidFunctionArg_fseeko(FILE* stream, off_t offset, int origin)
226226
(void)fseeko(stream, offset, SEEK_END);
227227
}
228228

229+
int nullPointer_utimes(const char *path, const struct timeval times[2])
230+
{
231+
// cppcheck-suppress nullPointer
232+
// cppcheck-suppress utimesCalled
233+
(void)utimes(NULL, times);
234+
// cppcheck-suppress utimesCalled
235+
return utimes(path, times);
236+
}
237+
229238
char * overlappingWriteFunction_stpcpy(char *src, char *dest)
230239
{
231240
// No warning shall be shown:

0 commit comments

Comments
 (0)