mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
maint: copy: avoid new static analyzer warnings
* src/copy.c (copy_internal): Use the lint protected src_mode, rather than accessing the src_sb again. Also unconditionally populate src_sb when !x->move_mode and in lint mode. Reported by Kamil Dudka with coverity and clang analyzer.
This commit is contained in:
1 parent
68cf7ad5ad
commit
3246bc08a6
1 file changed
+8
-1
+8
-1
@@ -1903,6 +1903,13 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#ifdef lint
|
||||
else
|
||||
{
|
||||
assert (x->move_mode);
|
||||
memset (&src_sb, 0, sizeof src_sb);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Detect the case in which the same source file appears more than
|
||||
once on the command line and no backup option has been selected.
|
||||
@@ -1910,7 +1917,7 @@ copy_internal (char const *src_name, char const *dst_name,
|
||||
This check is enabled only if x->src_info is non-NULL. */
|
||||
if (command_line_arg && x->src_info)
|
||||
{
|
||||
if ( ! S_ISDIR (src_sb.st_mode)
|
||||
if ( ! S_ISDIR (src_mode)
|
||||
&& x->backup_type == no_backups
|
||||
&& seen_file (x->src_info, src_name, &src_sb))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user