diff --git a/WHATS_NEW b/WHATS_NEW index f10e0e19c..eea24b549 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.01.08 - ================================ + Avoid some compiler warnings. Additional rename failure error message. read/write may be macros. diff --git a/lib/filters/filter-sysfs.c b/lib/filters/filter-sysfs.c index 572493715..aff384dee 100644 --- a/lib/filters/filter-sysfs.c +++ b/lib/filters/filter-sysfs.c @@ -172,7 +172,7 @@ static int _read_devs(struct dev_set *ds, const char *dir) unsigned char dtype; struct stat info; char path[PATH_MAX]; - dev_t dev; + dev_t dev = { 0 }; int r = 1; if (!(dr = opendir(dir))) { diff --git a/lib/format_text/archive.c b/lib/format_text/archive.c index 724ffff67..2075e4869 100644 --- a/lib/format_text/archive.c +++ b/lib/format_text/archive.c @@ -53,7 +53,7 @@ struct archive_file { struct list list; char *path; - int index; + uint32_t index; }; /* @@ -132,7 +132,8 @@ static char *_join(struct pool *mem, const char *dir, const char *name) static struct list *_scan_archive(struct pool *mem, const char *vgname, const char *dir) { - int i, count, ix; + int i, count; + uint32_t ix; char vgname_found[64], *path; struct dirent **dirent; struct archive_file *af; @@ -240,7 +241,7 @@ int archive_vg(struct volume_group *vg, uint32_t retain_days, uint32_t min_archive) { int i, fd, renamed = 0; - unsigned int ix = 0; + uint32_t ix = 0; struct archive_file *last; FILE *fp = NULL; char temp_file[PATH_MAX], archive_name[PATH_MAX]; @@ -285,7 +286,7 @@ int archive_vg(struct volume_group *vg, for (i = 0; i < 10; i++) { if (lvm_snprintf(archive_name, sizeof(archive_name), - "%s/%s_%05d.vg", dir, vg->name, ix) < 0) { + "%s/%s_%05u.vg", dir, vg->name, ix) < 0) { log_error("Archive file name too long."); return 0; } diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c index cd254c673..dc8d0e30e 100644 --- a/lib/format_text/import_vsn1.c +++ b/lib/format_text/import_vsn1.c @@ -31,7 +31,7 @@ typedef int (*section_fn) (struct format_instance * fid, struct pool * mem, struct hash_table * pv_hash); #define _read_int32(root, path, result) \ - get_config_uint32(root, path, result) + get_config_uint32(root, path, (uint32_t *) result) #define _read_uint32(root, path, result) \ get_config_uint32(root, path, result) diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 495a86729..35b9b3369 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -978,7 +978,7 @@ static void _close_stray_fds(void) { struct rlimit rlim; int fd; - char *suppress_warnings = NULL; + int suppress_warnings = 0; if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) { fprintf(stderr, "getrlimit(RLIMIT_NOFILE) failed: %s\n", diff --git a/tools/tools.h b/tools/tools.h index 24ac70044..c6b8a7ce3 100644 --- a/tools/tools.h +++ b/tools/tools.h @@ -135,7 +135,7 @@ int alloc_arg(struct cmd_context *cmd, struct arg *a); char yes_no_prompt(const char *prompt, ...); /* we use the enums to access the switches */ -static inline const unsigned int arg_count(struct cmd_context *cmd, int a) +static inline unsigned int arg_count(struct cmd_context *cmd, int a) { return cmd->args[a].count; } @@ -151,25 +151,25 @@ static inline const char *arg_str_value(struct cmd_context *cmd, int a, return arg_count(cmd, a) ? cmd->args[a].value : def; } -static inline const int32_t arg_int_value(struct cmd_context *cmd, int a, +static inline int32_t arg_int_value(struct cmd_context *cmd, int a, const int32_t def) { return arg_count(cmd, a) ? cmd->args[a].i_value : def; } -static inline const uint32_t arg_uint_value(struct cmd_context *cmd, int a, +static inline uint32_t arg_uint_value(struct cmd_context *cmd, int a, const uint32_t def) { return arg_count(cmd, a) ? cmd->args[a].ui_value : def; } -static inline const int64_t arg_int64_value(struct cmd_context *cmd, int a, +static inline int64_t arg_int64_value(struct cmd_context *cmd, int a, const uint64_t def) { return arg_count(cmd, a) ? cmd->args[a].i64_value : def; } -static inline const uint64_t arg_uint64_value(struct cmd_context *cmd, int a, +static inline uint64_t arg_uint64_value(struct cmd_context *cmd, int a, const uint64_t def) { return arg_count(cmd, a) ? cmd->args[a].ui64_value : def; @@ -181,13 +181,13 @@ static inline const void *arg_ptr_value(struct cmd_context *cmd, int a, return arg_count(cmd, a) ? cmd->args[a].ptr : def; } -static inline const sign_t arg_sign_value(struct cmd_context *cmd, int a, +static inline sign_t arg_sign_value(struct cmd_context *cmd, int a, const sign_t def) { return arg_count(cmd, a) ? cmd->args[a].sign : def; } -static inline const int arg_count_increment(struct cmd_context *cmd, int a) +static inline int arg_count_increment(struct cmd_context *cmd, int a) { return cmd->args[a].count++; }