mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cov: annotate to silent some coverity warning
This commit is contained in:
parent
bbf352892d
commit
5c7d6083a9
@ -1441,7 +1441,8 @@ static int _open_fifo(const char *path)
|
||||
} else if (!S_ISFIFO(st.st_mode) || st.st_uid ||
|
||||
(st.st_mode & (S_IEXEC | S_IRWXG | S_IRWXO))) {
|
||||
log_warn("WARNING: %s has wrong attributes: Replacing.", path);
|
||||
if (unlink(path)) {
|
||||
/* coverity[toctou] don't care, path is going to be recreated */
|
||||
if (unlink(path) && (errno != ENOENT)) {
|
||||
log_sys_error("unlink", path);
|
||||
return -1;
|
||||
}
|
||||
@ -1449,6 +1450,7 @@ static int _open_fifo(const char *path)
|
||||
|
||||
/* Create fifo. */
|
||||
(void) dm_prepare_selinux_context(path, S_IFIFO);
|
||||
/* coverity[toctou] revalidating things again */
|
||||
if ((mkfifo(path, 0600) == -1) && errno != EEXIST) {
|
||||
log_sys_error("mkfifo", path);
|
||||
(void) dm_prepare_selinux_context(NULL, 0);
|
||||
|
@ -7167,6 +7167,8 @@ char *generate_lv_name(struct volume_group *vg, const char *format,
|
||||
high = i;
|
||||
}
|
||||
|
||||
/* only internally passed %d are supported */
|
||||
/* coverity[non_const_printf_format_string] */
|
||||
if (dm_snprintf(buffer, len, format, high + 1) < 0)
|
||||
return NULL;
|
||||
|
||||
|
@ -3555,6 +3555,7 @@ static void _nonroot_warning(void)
|
||||
log_warn("WARNING: Running as a non-root user. Functionality may be unavailable.");
|
||||
}
|
||||
|
||||
/* coverity[-tainted_data_sink:arg-1] */
|
||||
int lvm2_main(int argc, char **argv)
|
||||
{
|
||||
const char *base;
|
||||
|
@ -33,6 +33,7 @@ static char *_expand_filename(const char *template, const char *vg_name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* coverity[non_const_printf_format_string] */
|
||||
if (dm_snprintf(filename, PATH_MAX, template, vg_name) < 0) {
|
||||
log_error("Error processing filename template %s",
|
||||
template);
|
||||
|
Loading…
Reference in New Issue
Block a user