1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

Avoid some compiler warnings.

This commit is contained in:
Alasdair Kergon 2005-03-10 22:34:17 +00:00
parent e5def0bab5
commit 7e0b7fd0e5
6 changed files with 16 additions and 14 deletions

View File

@ -1,5 +1,6 @@
Version 2.01.08 -
================================
Avoid some compiler warnings.
Additional rename failure error message.
read/write may be macros.

View File

@ -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))) {

View File

@ -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;
}

View File

@ -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)

View File

@ -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",

View File

@ -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++;
}